IOS 7 navigation bar problems with uinvigationcontroller

I added how the user interface views different versions of iOS.

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

The first problem is the status bar in iOS 6 I do not have a status bar. The second problem is overspending the two views. How to solve it?

+4
source share
3 answers

You can hide the status bar in the presented view manager by writing this method

 - (BOOL)prefersStatusBarHidden { return YES; } 
+1
source

You might want to use a resizable image:

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

Or, as AliSoftware suggested, set the extended edges of the edge to UIRectEdgeNone (be sure to check if edgesForExtendedLayout is edgesForExtendedLayout (your application will fail if it is connected to assign this property running iOS 6.x):

 if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) { self.edgesForExtendedLayout = UIRectEdgeNone; } 
+4
source

I would urge you to read the Apple UI Migration 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 status, even in iOS7, set UIViewController self.edgesForExtendedLayout = UIRectEdgeNone to your viewDidLoad .

+2
source

Source: https://habr.com/ru/post/1502277/


All Articles