Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 7 navigation bar of uinvigationcontroller issue

Tags:

ios

ios7

I have attached how UI looks on the different iOS versions.

This is my code below:

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:contactsViewController];
[self.viewController presentModalViewController:navController animated:YES];

iOS 6

enter image description here

iOS 7

enter image description here

First problem is status bar in iOS 6 I have not status bar. Second problem is overdrawing two views. How to solve it?

like image 923
Matrosov Oleksandr Avatar asked Mar 22 '23 10:03

Matrosov Oleksandr


2 Answers

You may wish to use a resizable image:

[image resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0) resizingMode:UIImageResizingModeStretch];

Or, as AliSoftware suggested, set the extended layout edges to UIRectEdgeNone (be sure to check if edgesForExtendedLayout is supported (your app will crash if it ties to assign this property running on iOS 6.x device):

if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
    self.edgesForExtendedLayout = UIRectEdgeNone;
}
like image 66
akashivskyy Avatar answered Apr 01 '23 13:04

akashivskyy


I would strongly invite you to read Apple's "UI Transition Guide" which explains all these differences between iOS6 and iOS7 and how to adapt your code accordingly.

The easiest way if you want your view to still be under your statusBar even in iOS7 is to set your UIViewController's self.edgesForExtendedLayout = UIRectEdgeNone in its viewDidLoad.

like image 43
AliSoftware Avatar answered Apr 01 '23 11:04

AliSoftware