0

I am having an issue with my tab view controller. I have 3 sections and out of those two work well with the status bar. However the third does not. It does not push down the title and you can see the status bar below the top bar!

Any help would be awesome. Here is my delegate which I've tried tweaking to make this work - but nothing is working for me. Anyone else had this issue?

Here is an image of the problem:

Status Bar Issue

And here is my delegate method:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];

    UINavigationController *navigationController = (UINavigationController *)[[tabBarController viewControllers] objectAtIndex:0];
    TreasureLogViewController *treasureLogViewController = (TreasureLogViewController *)[[navigationController viewControllers] objectAtIndex:0];
    treasureLogViewController.managedObjectContext = self.managedObjectContext;

    navigationController = (UINavigationController *)[[tabBarController viewControllers] objectAtIndex:1];
    LocationsViewController *locationsViewController = (LocationsViewController *)[[navigationController viewControllers] objectAtIndex:0];
    locationsViewController.managedObjectContext = self.managedObjectContext;


    MapViewController *mapViewController = (MapViewController *)[[tabBarController viewControllers] objectAtIndex:2];
    mapViewController.managedObjectContext = self.managedObjectContext;

    return YES;
}
Sean Herman
  • 313
  • 2
  • 15

1 Answers1

1

1. That's what you need: Preventing the Status Bar from Covering Your Views.

2. Try navigationBar.translucent = NO; (It is YES by default)

From Apple's iOS7 TransitionGuide:

New behavior on iOS 7. Default is YES. You may force an opaque background by setting the property to NO. If the navigation bar has a custom background image, the default is inferred from the alpha values of the image—YES if it has any pixel with alpha < 1.0 If you send setTranslucent:YES to a bar with an opaque custom background image it will apply a system opacity less than 1.0 to the image. If you send setTranslucent:NO to a bar with a translucent custom background image it will provide an opaque background for the image using the bar's barTintColor if defined, or black for UIBarStyleBlack or white for UIBarStyleDefault if barTintColor is nil.

3. And finally, if either doesn't work look at UIBarPositioningDelegate

skywinder
  • 21,291
  • 15
  • 93
  • 123