The white status bar disappears when the navigation bar is displayed with a tint of color in iOS 7

I have 2 UIViewControllers. In the first UIViewController, let's say ViewController1, I keep UINavigationBarhidden. Since the theme of my application is black, I need white UIStatusBarin iOS 7so that it does not become invisible in black UINavigationBar. To get white, UIStatusBarI use this method in iOS 7.

  • set UIViewControllerBasedStatusBarAppearanceto YESinplist
  • in viewDidLoadmake a[self setNeedsStatusBarAppearanceUpdate];
  • add the following method:

    -(UIStatusBarStyle)preferredStatusBarStyle{ 
      return UIStatusBarStyleLightContent; 
    } 
    

It works great when I am in ViewController1. But when I go to ViewController2, then if I install

self.navigationController.navigationBarHidden = NO 

viewDidLoad. UIStatusBar . UIStatusBar , , UINavigationBar

self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:UITextAttributeTextColor];
self.navigationController.navigationBar.translucent = NO; 

UINavigationBar , ViewController1, UIStatusBar . UINavigationBar, . .

- , , ​​ ViewController1? .

+4
2

-(UIStatusBarStyle)preferredStatusBarStyle{ 
    return UIStatusBarStyleLightContent; 
}
+6

, , plist: NO.

. @caglar , .

0

All Articles