简体   繁体   中英

Navigation Bar hiding status bar

Like the title says, I have a navigation bar that is hiding my status bar. I have been running my application on a simulator and recently started running it on a device, iPhone 4s iOS7, and noticed that the status bar is hidden or being hidden, only thing you can see is the green battery life. The reason that I think it is being hidden is that I have a search bar in one of my view controllers and when I'm using the search bar you can see the status bar, the cell provider, time, etc.

Things I've done to see if I didn't do it accidentally:

Checked the Target-> Deployment Info ->Status Bar Style. It is in Default.

Checked each xib file to see if the status bar is set to none. All of them are at Default.

Searched the keyword "hidden" in all my .m files.

Anyone have any suggestions? I've searched through here and only see posts about people actually wanting to hide it not fixing it. If anyone has had something similar happen to them, I'm open to trying anything.

Answer:

I was using a navigation bar image and the sizes were different. 
I was using iOS6 bar size, 32x32, but now I am using 88x64 and 
that fixed it for iOS7. How do I check if phone is iOS6 or iOS7?

The status bar is not hidden. On iOS 7, the status bar is always visible and it overlaps your application in a way it did not on iOS 6 and earlier. This is the new "normal" behavior. The status bar no longer has a background color. It is either black text on a clear background ( UIStatusBarStyleDefault ) or light text on a clear background ( UIStatusBarStyleLightContent ).

If you change the status bar appearance to Light Content you will be able to see your status bar on a dark background.

Status bar appearance is controlled along one of two mutually-exclusive basis paths: you can either set them programmatically in the traditional manner, or UIKit will update the appearance for you based on some new properties of UIViewController. The latter option is on by default. Check your app's plist value for "ViewController-Based Status Bar Appearance" to see which one you're using. If you set this value to YES , every top-level view controller in your app (other than a standard UIKit container view controller) needs to override preferredStatusBarStyle , returning either the default or the light style. If you edit the plist value to NO , then you can manage the status bar appearance using the familiar UIApplication methods.

I know its knida too late but this approach solved my issue with the Status bar:

What I did was set the

   self.view.backgroundcolor=[UIcolor WhiteColor];

and then Created a subview within the main view with the same width and height as self.view and then modified its frame accordingly such as:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
    if(self.customView.frame.origin.y == 0) {
        CGRect viewBounds = [self.customView bounds];
        viewBounds.origin.y = 20;
        viewBounds.size.height = viewBounds.size.height - 20;
        self.customView.frame = viewBounds;
    }

}

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