StatusBar、NavigationBar在iOS7中如何显示?如何适配IOS6?
1、plist中设置: View controller-based status bar appearance为NO 设置status bar的状态(在IOS7中就是文字颜色)不会跟随这viewController来变化,可以在appDelegate中统一设置
2、
- (UIStatusBarStyle)preferredStatusBarStyle
{
returnUIStatusBarStyleLightContent;
}
这个方法只在最高级别的viewcontroller(every top-level view controller in your app (other than a standard UIKit container view controller) )中调用,例如navigationController。
3、
UIViewController的属性:
edgesForExtendedLayout
虽然每个
UIViewController都有这个属性,但是大部分情况下设置这个属性时当否没有用,除非你把这个UIViewController添加到了UINavigationController,然后这个属性就有用了。
在viewDidLoad中添加这样的代码,viewController就会正常显示了:
if (IS_iOS7) {
self.edgesForExtendedLayout = UIRectEdgeNone;
}
4、
automaticallyAdjustsScrollViewInsets
很好的文章,首先应该看看: