Pregunta

I can't find what is wrong with UITextField (or UIStatusBar).

In my

- (BOOL)application:(UIApplication *)application 
        didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

I have:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

Also in my view controller I have this:

-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

The color of UIStatusBar is always white as I want it to be. But whenever I select UITextField, it's color changes to black. I don't want that, and I always want it to be white.

Strange but I can't find any similar issues on the net, so I'm hoping for your help. Any help is appreciated. Thanks in advance!

¿Fue útil?

Solución

If you always want the UIStatusBar with whiteColor insert the line like you did in didFinishLaunching

[[UIApplication sharedApplication]
   setStatusBarStyle:UIStatusBarStyleLightContent];

and than also set a value for the statusbar inside info.plist like this

enter image description here

You just need to set preferredStatusBarStyle inside a UIViewController if you want to change the color for a single controller.

Otros consejos

Just Set the UIViewControllerBasedStatusBarAppearance to YES in the plist file and also put in viewDidLoad method [self setNeedsStatusBarAppearanceUpdate]; may be its work for you.

Set the UIViewControllerBasedStatusBarAppearance to YES in the plist

In viewDidLoad do a [self setNeedsStatusBarAppearanceUpdate];

Add the following method:

-(UIStatusBarStyle)preferredStatusBarStyle{ 
  return UIStatusBarStyleLightContent; 
}

Okay this must not happen and so i don't see a need of setting the UIStatusBarStyle again and again... could you give a little more information about your UITextField?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top