0

Is there a way to change the color color of the top bar on an iPhone that shows the battery?

My phone is showing as black text on white background but I wanted to know how to change it to white text on a black background. How would this be done?

4

3 回答 3

1

Try this:

if ([self.navigationController.navigationBar respondsToSelector:@selector(setTranslucent:) ])
    self.navigationController.navigationBar.translucent = NO;

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
于 2013-10-26T06:30:09.467 回答
0

Here try this:

- (UIStatusBarStyle)preferredStatusBarStyle {

    return UIStatusBarStyleLightContent;
}

If that doesn't work then change it in your info plist Status Bar Style to UIStatusBarStyleLightContent.

于 2013-10-26T06:31:28.930 回答
0

For iOS < 7, you can use any of the below mentioned styles apart from the default ones:

[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackOpaque];
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackTranslucent];

For iOS 7 follow these steps:

1. Set the UIViewControllerBasedStatusBarAppearance to YES in the plist

2. In viewDidLoad do a [self setNeedsStatusBarAppearanceUpdate];

3. Add the following method:

-(UIStatusBarStyle)preferredStatusBarStyle{ 
    return UIStatusBarStyleLightContent; 
}
于 2013-10-26T06:33:44.750 回答