简体   繁体   English

iOS7状态栏问题

[英]iOS7 Status Bar issue

I have found many links for Status Bar issue in iOS 7 bt none of them helped much. 我在iOS 7 bt中发现了许多关于状态栏问题的链接,但没有一个帮助很大。

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. 问题是我的应用程序在iOS6中运行良好,但是当我尝试在iOS7上运行它时,我希望iOS7的外观和感觉。

The status bar gels nicely with a UIViewController like below : 状态栏与UIViewController很好地融合在一起,如下所示: 具有UIVewController的statusBar

But for UINavigationController it goes black like below : 但是对于UINavigationController它变成黑色,如下所示: 具有UINavigationController的statusBar

I managed to change the text-color of the statusBar using the following code in AppDelegate : 我设法在AppDelegate中使用以下代码来更改statusBar的文本颜色:

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 另外,我的plist文件具有以下条目: View controller-based status bar appearance设置为NO

and my AppDelegate has : 我的AppDelegate有:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

I want the statusBar to take the Blue color when a NavigationController is loaded. 我希望在加载NavigationController时statusBar采取蓝色。

NOTE : I have used the following code for iOS7 support : 注意:我已经为iOS7支持使用以下代码:

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

Don't know if this caused the issue. 不知道这是否引起了问题。

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/ http://www.appcoda.com/customize-navigation-status-bar-ios-7/

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. 一个用于iOS7(高20像素),另一个用于其他,并将此图像设置为navBar的背景。

Hope this help :) 希望这个帮助:)

There's a good and explained answer here. 这里有一个很好的解释性答案。

Status bar and navigation bar issue in IOS7 IOS7中的状态栏和导航栏问题

and here 和这里

iOS 7 - Status bar overlaps the view iOS 7-状态栏与视图重叠

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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