1

In my App Delegate I have the following code, but it stays completely dark above the navigation bar, where you can't see anything. If I remove the background image for the navigation bar, it properly shows it as light content, but I'm not sure what would be blocking it when present. The background image for UINavigationBar is 320x44.

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

    UIImage *theBackground = [[UIImage imageNamed:@"navbar.png"]resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];;
    if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
        // Load resources for iOS 6.1 or earlier
       // UIColor *purple = UIColorFromRGB(0x95cdde);
        [[UINavigationBar appearance] setBackgroundImage:theBackground forBarMetrics:UIBarMetricsDefault];



    } else {
        // Load resources for iOS 7 or later
       // UIColor *purple = UIColorFromRGB(0x95cdde);

        [[UINavigationBar appearance] setBackgroundImage:theBackground forBarMetrics:UIBarMetricsDefault];

    }
    window.rootViewController = tabBarController;
    [window makeKeyAndVisible];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

    return YES;
}

Here is the navigation bar image enter image description here

user717452
  • 33
  • 14
  • 73
  • 149

2 Answers2

1

Okay, so this is my understanding. Hopefully someone corrects me if I am wrong. In iOS 7, the navigation bar background image also extends under the status bar. So it is likely that the navigation bar background image is blocking the status bar.

I had the same issue, sort of, in my app. I had an image picker and on pushing that controller, the status bar content became dark. The following code solved the issue for me

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

I also had to set the UIViewController as UINavigationControllerDelegate

Zia
  • 14,622
  • 7
  • 40
  • 59
1

Found this article http://blog.jaredsinclair.com/post/61507315630/wrestling-with-status-bars-and-navigation-bars-on-ios-7 which helped me figure out my problem. Needed to add this in my plist

ViewController-Based Status Bar Appearance and set it to NO

user717452
  • 33
  • 14
  • 73
  • 149