iOS 7: modal view controller status bar is wrong color but normal view controllers are correct

前端 未结 9 1504
慢半拍i
慢半拍i 2021-02-05 06:20

I have an issue in iOS7 where a normal UINavigationController pushed view controller has the correct status bar text color for the UINavigationController navbar color (which is

9条回答
  •  天命终不由人
    2021-02-05 06:57

    I just figured out how to do that. I had the exact same problem and it seems that it works like a charm!

    The first thing you need to do is to change an attribute in you .plist file of your project to NO. The attribute is: "View controller-based status bar appearance". If the attribute doesn't exist, don't hesitate to add a new one exactly as I just written to you (without quotes).

    The second thing is to add to each view controller's viewDidLoad method

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    

    if you want your status bar's text to be white or

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
    

    if you want your status bar's text to be black.

    That's all!

提交回复
热议问题