IOS7 Status bar hide/show on select controllers
The plist setting "View controller-based status bar appearance"
only controls if a per-controller based setting should be applied on iOS 7.
If you set this plist option to NO, you have to manually enable and disable the status bar like (as it was until iOS 6):
[[UIApplication sharedApplication] setStatusBarHidden:YES]
If you set this plist option to YES, you can add this method to each of your viewControllers to set the statusBar independently for each controller (which is esp. nice if you have a smart subclass system of viewControllers)
- (BOOL)prefersStatusBarHidden {
return YES;
}
Edit:
there are two more methods that are of interest if you are opting in the new viewController-based status bar appearance -
Force a statusbar update with:
[self setNeedsStatusBarAppearanceUpdate]
If you have nested controllers (e.g. a contentViewController in a TabBarController subclass, your TabBarController subclass might ask it's current childViewController and forward this setting. I think in your specific case that might be of use:
- (UIViewController *)childViewControllerForStatusBarHidden {
return _myChildViewController;
}
- (UIViewController *)childViewControllerForStatusBarStyle {
return _myOtherViewController;
}
Hide status bar in all view controllers - IOS
Go to your Info.plist file and add a new attribute:
View Controller based status bar appearance
and set it to NO
.
Then go to App Delegate and replace your method to this:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
UIApplication.shared.isStatusBarHidden = true
return true
}
Cannot hide status bar in iOS7
in your apps plist file add a row call it "View controller-based status bar appearance" and set it to NO
Note that this simply does not work, if you are using UIImagePickerController in the app.
from http://www.openfl.org/developer/forums/general-discussion/iphone-5ios-7-cant-hide-status-bar/, mgiroux's solution
Hide Status Bar in iOS 13
Step 1 :- add permission
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 ...:)
Related Topics
iOS Scrollview Needs Constraint for Y Position or Height
How to Delay a Method Call for 1 Second
How to Add 2 Buttons into the Uinavigationbar on the Right Side Without Ib
When Do I Need to Call Setneedsdisplay in iOS
Checking a Null Value in Objective-C That Has Been Returned from a JSON String
How Is the Relation Between Uiview's Clipstobounds and Calayer's Maskstobounds
Uibutton Doesn't Listen to Content Mode Setting
Uicollectionview Adding Uicollectioncell
Upload Image to the PHP Server from iOS
Uiscrollview with Centered Uiimageview, Like Photos App
Add Shadow on Uiview Using Swift 3
Build Not Visible in Itunes Connect
Convert Uiimage to Nsdata and Convert Back to Uiimage in Swift
How to Change the Color of the Text in a Uipickerview Under iOS 7
When Should Translatesautoresizingmaskintoconstraints Be Set to True
Swift: Unrecognized Selector Sent to Instance
Format Uitextfield Text Without Having Cursor Move to the End