Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios 7 UiView frame issue

I am running same app in iOS6 and iOS7 which has NavigationBar.It runs well on iOS6, but in iOS7, all view is little bit up like it is not considering the Navigation bar at all.

I have tried changing topbar property in simulated metrics option but it doesnt work. It considers button's position from NavigationBar in iOS6, but in iOS7, it considers it from top of the screen.

What is the reason for it?

Thanks in advance.

iOS 6 Screenshot

iOS 7 Screenshot

like image 602
PK86 Avatar asked Aug 16 '13 14:08

PK86


3 Answers

You should use below line for fix it in your view.

 self.edgesForExtendedLayout = UIRectEdgeNone;
like image 83
sinh99 Avatar answered Nov 18 '22 11:11

sinh99


In "iOS 7 UI Transition Guide" for Layout and Appearance one also mentioned - in iOS7 in, view controllers use the full screen layout.

If we want the view shows the following location from the navigation bar, you can modify the UIViewController's edgesForExtendedLayout this property to achieve.

edgesForExtendedLayout is a type UIExtendedEdge attribute that specifies the direction of the edge to be extended.

Because iOS7 encourage full screen layout, its default value is natural to be UIRectEdgeAll, both extending around the edge, that is, if there is even the view navigationBar, under tabBar, then the view will extend coverage to the surrounding area.

If we make the following settings view, then the view will not be extended to those behind the bar, so label came out. View Source Print

self . edgesForExtendedLayout = UIRectEdgeNone ;
like image 33
PK86 Avatar answered Nov 18 '22 12:11

PK86


In iOS 7, view controllers use full-screen layout. it is mentioned in iOS 7 UI Transition Guide

if you want change the layout use edgesForExtendedLayout property

example:

   if([UIViewController instancesRespondToSelector:@selector(edgesForExtendedLayout)])

        self.edgesForExtendedLayout=UIRectEdgeNone;
like image 8
hema Avatar answered Nov 18 '22 13:11

hema