1.将 View controller-based status bar appearance 删除(默认为 YES),或设置为YES
2.设置rootViewcontroller,如果为viewController,那么重写下面的方法
-(UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
如果rootviewcontroller为navgationController,那么可以在所管理的viewcontroller里写下面的代码
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
或者为navgationcontroller写一个分类
.h
@interface UINavigationController (StatusBarStyle)
@end
.m
#import "UINavigationController+StatusBarStyle.h"
@implementation UINavigationController (StatusBarStyle)
- (UIStatusBarStyle)preferredStatusBarStyle
{
//also you may add any fancy condition-based code here
return UIStatusBarStyleLightContent;
}
@end