简体   繁体   中英

Cannot change status bar text color on large screen iPhone

I'm working on an old Object C app using tabBarController . Because setStatusBarStyle that was used to set status bar text to white is deprecated in iOS 9 so I deleted it and changed the .plist file like: 在此处输入图片说明

I also changed Status Bar Style in Deployment Info to 'Light'. It worked fine with iPhone SE and 5 (checked with iOS 9.3 and 11) but for some reason didn't work with larger devices such as iPhone 6 or 7. Status bar and its content (time, battery etc.) are both black. I tried preferredStatusBarStyle as suggested and some other instructions but nothing worked perfectly for me.

Your answer is here:

This code use every UIViewController

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}

Try this code:

[[UIApplication sharedApplication] setStatusBarHidden:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

use - (void)viewDidLoad or - (void)viewWillAppear:(BOOL)animated - (void)viewWillDisappear:(BOOL)animated

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM