Search code examples
swiftuistatusbar

Hide Status Bar in iOS 13


Hiding Status Bar using the usual way doesn't work because the method is deprecated. enter image description here

The status bar has to be hidden in one view controller, but not all of them. How can I hide/show it programmatically?


Solution

  • Step 1 :- add permission

    enter image description here

    Step 2 :- add the below code in desired view controller to hide the status bar .

    override var prefersStatusBarHidden: Bool {
         return true
    }
    

    NOTE :- if you don't set constrain properly after the hidden true / false you will have design issues , so take care about it ...:)