Search code examples
iosios7statusbar

IOS 7 status bar is not displayed?


I want to design my navigation bar in IOS7 and i use this code.

  UIImage *navBackgroundImage = [UIImage imageNamed:@"navbar"];

    [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav_bg.png"] forBarMetrics:UIBarMetricsDefault];

But my status bar is not displayed(Please see the picture). I use this code in 2 project but other project is ok. I dont know what i am doing wrong Please help me.

This result I dont want

enter image description here

This status bar is correct.

enter image description here


Solution

  • In Info.plist set 'View controller-based status bar appearance' as NO

    In AppDelegate add

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
      [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    }  
    

    This solution works for iOS 7