How to disable automatic layout for only one view (not for the whole story) xcode

I just want to enable the automatic layout function for one view only in the mystoryboard. perhaps, and if so, how to do it. I am using xcode 4.6.3

+6
source share
3 answers

From the answer given by Muhammad AamirAli here , it is possible. Here is the 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]; 
+4
source

This has not yet been tested, but it can work and override the automatic layout performed in the interface builder, and also allows you to specify an array of views: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AutoLayoutinCode/ AutoLayoutinCode.html

+1
source

Technically, everyone is right that they cannot turn off the automatic layout for individual scenes in the storyboard. However, even if the global “switch” for automatic layout is included in the storyboard, you can still use autoresist masks (that is, a system of springs and spacers) anywhere. Although the system will convert masks to “auto-resize” behind the scenes, you don’t have to directly address the restrictions.

Just make sure that when you select / initialize the view programmatically, you set your translatesAutoresizingMaskIntoConstraints property to YES.

+1
source

All Articles