1

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?

Ketan
  • 487
  • 10
  • 23

4 Answers4

3

Try this code in ViewController it works for me

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
  {
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
  }
moosa0709
  • 476
  • 3
  • 12
  • My `UIViewController` is a single page with no navigation bar and so on, so this method does not get call. – Ketan Feb 14 '14 at 07:55
1

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.

Ketan
  • 487
  • 10
  • 23
0

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];

}
iPatel
  • 46,010
  • 16
  • 115
  • 137
  • I have already ` Set the "View controller-based status bar appearance" to "NO" in the plist` – Ketan Feb 14 '14 at 06:58
0

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/

gajchtr
  • 48
  • 5