UIApplication.SharedApplication.SetStatusBarHidden
(MonoTouch code, but also applies to Obj-C) does the job for iOS 6, but for iOS 7 we must:
SetNeedsStatusBarAppearanceUpdate ()
on the view controller (e.g.: a view controller that is showing a fullscreen image)PrefersStatusBarHidden ()
on the same view controller.However the view controller mentioned above is embedded in a navigation controller, which is also embedded in a slideout menu. Even though all embedded view controllers are added to the hierarchy using AddChildViewController()
, attempting to update the status bar in a child view controller has no effect.
Any ideas?
EDIT
Window.RootViewController (Menu)
|___ ViewControllerA (Navigation Bar)
|___ ViewControllerB (Actual View controller)
Where ViewControllerB
wants to hide/show the status bar
ViewControllerA should override childViewControllerForStatusBarHidden and return ViewControllerB.
- (UIViewController *)childViewControllerForStatusBarHidden {
return _viewControllerB;
}
It does not appear entirely what you attempt to do. If you simple want to hide the statusbar in all child viewcontrollers, you could set the new plist propertyUIViewControllerBasedStatusBarAppearance
.
... If you prefer to opt out of this behavior and set the status bar style by using the UIApplication statusBarStyle method, add the UIViewControllerBasedStatusBarAppearance key to an app’s Info.plist file and give it the value NO.
source:https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/Bars.html#//apple_ref/doc/uid/TP40013174-CH8-SW1
The source is BTW a really good reference to all kinds of information related to the handling of UINavigationBar
and UIStatusBar
in iOS7.
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