Reputation: 131
iOS8.1(xcode 6.1) I used the below method to change the status bar text color.
[self setNeedsStatusBarAppearanceUpdate];
-(UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent; }
following the link preferredStatusBarStyle isn't called
But this is not working for me.Anyone knows how to change status bar color related to uinavigationcontroller.
Upvotes: 0
Views: 1365
Reputation: 654
You can customize the title text style on UINavigationControllers by assigning an NSDictionary containing your settings to the titleTextAttributes property.
NSDictionary *titleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], NSForegroundColorAttributeName, nil];
[[UINavigationBar appearance] setTitleTextAttributes:titleTextAttributes];
More stack overflow discussion here, and apple ref here.
Upvotes: 0
Reputation: 1615
UIViewControllerBasedStatusBarAppearance
to YES in your info.plist- (UIViewController *)childViewControllerForStatusBarStyle
in your navigationController. return your childVCpreferredStatusBarStyle
or something need.code:
- (UIStatusBarStyle)preferredStatusBarStyle{
return self.test?UIStatusBarStyleLightContent:UIStatusBarStyleDefault;
}
- (IBAction)test:(id)sender {
self.test = !self.test;
[self setNeedsStatusBarAppearanceUpdate];
}
let me know if it don't work.
Upvotes: 1