-1

In this below screenshot you can see when i present modally than the base viewController status bar is quickly hidden and when i dismiss this modal than is will quick show. so, How i can avoid this and fixed status bar when present modally.

enter image description here

Thank you.

Virani Vivek
  • 888
  • 1
  • 8
  • 22

2 Answers2

1

You can achieve your requirement by using below code.

Swift 3 & Swift 4

override var prefersStatusBarHidden: Bool {
  return true
}

you can update the state once the view controller is already being displayed, you will need to call:

setNeedsStatusBarAppearanceUpdate()

Please refer to the documentation.

Hitesh Surani
  • 12,733
  • 6
  • 54
  • 65
0
override func viewDidLoad(){
    super.viewDidLoad()
    navigationController?.navigationBar.barStyle = .default
}

override var prefersStatusBarHidden: Bool {
    return true
}

I applied scroll view also in the same screen, by this code was able to resolve status bar issue.

Deviyani Swami
  • 749
  • 8
  • 17