2
@implementation UIViewController (preferredStatusBar)
-(UIStatusBarStyle) preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}
@end

I made this category so all the controllers implements this attribute, UIStatusBarStyleLightContent can change during application.

Everything works fine except for modal controllers. They ignore completely status bar style.

Baby Groot
  • 4,637
  • 39
  • 52
  • 71
teixeiras
  • 101
  • 8

1 Answers1

2

I imagine that you are loading a modal view controller as a UINavigationController. But you haven't provided enough information to be sure.

If this is the case you would need to override the method preferredStatusBarStyle for the UINavigationController as well.

shim
  • 9,289
  • 12
  • 69
  • 108
StuartM
  • 6,743
  • 18
  • 84
  • 160
  • UINavigationController is a subclass from UIViewController, it receives also this behaviour (tried with breakpoints ) – teixeiras Oct 07 '13 at 10:47
  • 1
    Correct, but you have a category. Does the UINavigationController use this category? Have you seen that this method is being called in the appropriate navigation controller. – StuartM Oct 07 '13 at 11:01
  • Right. I also refer to this question - http://stackoverflow.com/questions/18999019/how-to-change-uistatusbarstyle-in-ios-7-in-modal-views-with-navigation-bar - When you say it is ignored, what is the style being used? Is this setup in storyboard, have you confirmed there is no override in there. – StuartM Oct 07 '13 at 11:15
  • The question is 100% related with the posted one. And no anwswer to... at least discover it works on none navigation controllers – teixeiras Oct 07 '13 at 15:00