To completely hide it on the home screen, open up an app, such as Settings, and wait about three to four seconds. Press the home button again, and the status bar will be completely gone.
Make sure your initial SwiftUI View is a Navigation view where you hide the status bar. Then if you navigate to a tab bar view or any subsequent views the status bar will be hidden.
You really should implement prefersStatusBarHidden on your view controller(s):
Swift 3 and later
override var prefersStatusBarHidden: Bool {
return true
}
Add the code, inside the method
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject:AnyObject]?) -> Bool {
application.statusBarHidden = true
return true
}
DONE! Run your app and no more status bar!
Swift 3
In Info.plist
set View controller-based status bar appearance
to NO
And call UIApplication.shared.isStatusBarHidden = true
If you want to hide and bring back the status bar on button tap, while at the time of presenting and dismissing slide-in menu, popups etc, then you can use this method:-
To hide the status bar:-
UIApplication.shared.keyWindow?.windowLevel = UIWindowLevelStatusBar
To bring back the status bar:-
UIApplication.shared.keyWindow?.windowLevel = UIWindowLevelNormal
if you prefer a visual approach rather than coding it use this method:
in your info.plist
simply add View controller-based status bar appearance
to NO
and Status bar is initially hidden
as YES
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With