UINavigationController ios7 - NavTab in front of view
-
20-12-2019 - |
Frage
I'm developing a new application to ios and i'm using UINavigationController. When i'm developing in the Xcode the view is that:
But in the simulator (iOS 7) this is the result:
And when i use iOS 6 in the simulator, this is the result:
This is my code for use UINavigationController:
RootController *controller = [[RootController alloc]init];
UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:controller];
self.window.rootViewController = navController;
Lösung
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
}
Andere Tipps
You need to set Delta of your view controller. Switch Story board to ios6.1 or later from utility area (1st item). Then select view of your Vc and in size inspector menu in utility area there will be delta section below frame. There will be triangle before every delta. Triangle y to 64 (you should be on ios6.1 or later of your storyboard).
If you need help on Deltas visit : Interface Builder: What are the UIView's Layout iOS 6/7 Deltas for?