关于导航栏设置状态栏样式问题

1.如果没有导航控制器,

- (UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}
在viewDidLoad中
[self setNeedsStatusBarAppearanceUpdate];这样才可以调用上面的方法,设置状态栏的样式

2.如果有导航控制器,那么这么做是无法调用设置状态栏的方法,此时要UINavigationController的category,在这个category中  

- (UIViewController *)childViewControllerForStatusBarStyle{
    return self.topViewController;
}

这样就可以设置状态栏的样式了.

无论是想设置导航栏为透明状态也可以这么做.

posted @ 2016-11-10 22:53  ReShadow  阅读(170)  评论(0编辑  收藏  举报