iOS7 Status Bar issue

2019-06-02 11:10发布

I have found many links for Status Bar issue in iOS 7 bt none of them helped much.

The issue is my application runs well in iOS6 but when I try to run it on iOS7, I want the iOS7 look and feel.

The status bar gels nicely with a UIViewController like below : statusBar with UIVewController

But for UINavigationController it goes black like below : statusBar with UINavigationController

I managed to change the text-color of the statusBar using the following code in AppDelegate :

if ([[UIView appearance] respondsToSelector:@selector(setTintColor:)]) {
        [[UIView appearance] setTintColor:[UIColor whiteColor]];
    }

Also, my plist file has the following entry : View controller-based status bar appearance set to NO

and my AppDelegate has :

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

I want the statusBar to take the Blue color when a NavigationController is loaded.

NOTE : I have used the following code for iOS7 support :

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
        self.edgesForExtendedLayout=UIRectEdgeNone;
#endif

Don't know if this caused the issue.

3条回答
The star\"
2楼-- · 2019-06-02 11:16

It works fine if you use different images. One for iOS7 (20px higher) and one for the others and set this image as background for your navBar.

Hope this help :)

查看更多
Juvenile、少年°
3楼-- · 2019-06-02 11:26

It's hard to find the solution to your problem, but try using this guide, is really good:

http://www.appcoda.com/customize-navigation-status-bar-ios-7/

查看更多
闹够了就滚
4楼-- · 2019-06-02 11:41
登录 后发表回答