简体   繁体   中英

iOS7 Hiding the status bar

I've tried everything I can think of/find to hide the status bar on iOS 7, but after the launch it appears:

//in viewDidLoad
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];

//in the main view controller
- (BOOL)prefersStatusBarHidden
{
    return YES;
}

I also set "Status bar is initially hidden", and "View controller-based status bar appearance" to YES in the info.plist.

Oddly, the status bar does hide after another controller appears, like a picker or the keyboard.

Try adding a new value to your info.plist:

View Controller based status bar appearance - NO

If you don't want view controllers to participate in the style and visibility of the status bar, add a "View Controller based status bar appearance" row to your info.plist and set it to NO . By default, in iOS 7, view controllers can participate in the status bar appearance process by overriding the prefersStatusBarHidden method. You could also notify UIKit about your status bar visibility change by calling [self setNeedsStatusBarAppearanceUpdate] .

If it's still not working, post a little bit more code to see a bigger picture of your problem. Maybe the cause is somewhere else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM