Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add top layout guide in NIB file (XIB) [duplicate]

How can I add top layout guide in NIB file or how can I specify space from the top navigation bar and status bar so that it does not create problem between ios 6 and iOS 7?

like image 788
Vibhooti Avatar asked Nov 26 '13 05:11

Vibhooti


People also ask

How do you add top and bottom layout in storyboard?

Select your view. Select 'Add New Constraints' option in the InterfaceBuilder. From the dropdown menu of top or bottom constraint, select the 'Top Layout Guide' or 'Bottom Layout Guide'.

What is top layout guide?

The topLayoutGuide property comes into play when a view controller is frontmost onscreen. It indicates the highest vertical extent for content that you don't want to appear behind a translucent or transparent UIKit bar (such as a status or navigation bar).

How do I add a safe area in Xib?

If you are creating a new xib or an storyboard in Xcode 9, safe area layout guide option is already enabled. You can disable this option explicitly by going into file inspector menu of Interface Builder and unchecking the option Use Safe Area Layout Guide.

How do I disable safe area layout guide?

You can disable safe area layout guide from storyboard for particular view controller. Select View Controller -> File Inspector (first tab) -> Use safe area layout guides (uncheck the checkbox).


2 Answers

You can do this by by implementing new property called edgesForExtendedLayout in iOS7 SDK

-(void)viewDidLoad {       if ([self respondsToSelector:@selector(edgesForExtendedLayout)])          self.edgesForExtendedLayout = UIRectEdgeNone; } 

or

If you are using navigation bar and xcode5 then..

In Interface Builder,select view controller, and then navigate to the attributes inspector. In "Extend Edges". check Under Top Bars

i have solved my problem from Here

like image 197
the1pawan Avatar answered Sep 18 '22 17:09

the1pawan


I think you need to write this condition for that

 float SystemVersion=[[[UIDevice currentDevice] systemVersion] floatValue];   if(SystemVersion<7.0f)    {      //Currently your app is running in IOS6 or older version. So you need not               to do anything.    }   else    {      // Currently your app is running in IOS7.    }  
like image 20
Parvendra Singh Avatar answered Sep 20 '22 17:09

Parvendra Singh