Search code examples
iosobjective-cmobileios6ios7

UINavigationController ios7 - NavTab in front of view


I'm developing a new application to ios and i'm using UINavigationController. When i'm developing in the Xcode the view is that:

enter image description here

But in the simulator (iOS 7) this is the result:

enter image description here

And when i use iOS 6 in the simulator, this is the result:

enter image description here

This is my code for use UINavigationController:

RootController *controller = [[RootController alloc]init];
UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:controller];
self.window.rootViewController = navController;

Solution

  • As already pointed out, a straightforward solution is adding this snippet in your viewController's viewDidLoad:

    if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) { // if iOS 7
        self.edgesForExtendedLayout = UIRectEdgeNone; //layout adjustements
    }