Question

I have an iOS 7 app and I have set the status bar text to white in didFinishLaunchingWithOptions as follows:

 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

I have a webview with a javascript that calls the native Image Picker. In the Image Picker, when I choose a Photo from the Gallery, the status bar text is reset to black.

One way to correct this is to apply the above code again when the Image Picker closes. However, I cannot detect this event since it is on the webview.

Any idea how to fix this?

Was it helpful?

Solution 2

I solved it by implementing this:

-(void) viewDidAppear:(BOOL)animated
{

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

    [super viewDidAppear:animated];

}

As soon as the Photo Gallery closes, this code is called.

OTHER TIPS

Try this code in ViewController it works for me

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
  {
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
  }

Try with below step.

-> Set the "View controller-based status bar appearance" to "NO" in the plist

And then use

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

        [UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

}

there is no instance method to change the color of status bar text. so you have to customize the status bar. you can check this link once.. http://www.appcoda.com/customize-navigation-status-bar-ios-7/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top