Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to turn off auto layout for only one view ( not the whole story board ) xcode

Tags:

xcode

ios

I just want to turn the auto layout feature for one view only in mystoryboard . is that possible and if yes , how do I do that . I'm using xcode 4.6.3

like image 808
user2988343 Avatar asked Dec 07 '13 23:12

user2988343


Video Answer


2 Answers

From the answer given by MuhammadAamirAli here, its possible. Here is a snapshot code from his answer, which I found useful.

[self.benchmarkButton removeFromSuperview];
[self.benchmarkButton setTranslatesAutoresizingMaskIntoConstraints:YES];
[self.benchmarkButton setFrame:CGRectMake(20, self.benchmarkButton.frame.origin.y+40, 260, 30)];
[self.benchmarksView addSubview:self.benchmarkButton];
like image 171
user2431285 Avatar answered Oct 08 '22 07:10

user2431285


This is not tested yet, but it could work and override the auto-layout done in interface builder, it also lets you specify a views array: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AutoLayoutinCode/AutoLayoutinCode.html

like image 23
Jeremiah Smith Avatar answered Oct 08 '22 06:10

Jeremiah Smith