The UINavigationController does
not forward on preferredStatusBarStyle calls
to its child view controllers. Instead it manages it's own state - as it should, it is drawing at the top of the screen where the status bar lives and so should be responsible for it. Therefor implementingpreferredStatusBarStyle in
your VCs within a nav controller will do nothing - it will never be called.
The trick is what the UINavigationController uses
to decide what to return forUIStatusBarStyleDefault or UIStatusBarStyleLightContent.
It bases this on it'sUINavigationBar.barStyle.
The default (UIBarStyleDefault)
results in the dark foregroundUIStatusBarStyleDefault status
bar style. And UIBarStyleBlack will
give aUIStatusBarStyleLightContent status
bar.
TL;DR:
If you want UIStatusBarStyleLightContent on
a UINavigationController use:
self.navigationController.navigationBar.barStyle = UIBarStyleBlack; (chenyong后来我在我的viewcontroller里加这句话实现,并未增加preferredStatusBarStyle
那三个方法且 View controller-based status bar appearance 也是默认的YES)
转载自:http://stackoverflow.com/questions/19022210/preferredstatusbarstyle-doesnt-to-get-called
610

被折叠的 条评论
为什么被折叠?



