Search code examples
iosobjective-cxcodeinterface-builderautolayout

Enabling/Disabling NSLayoutConstraints in InterfaceBuilder


NSLayoutConstraint (in iOS 8.0) has a BOOL property called active which makes it easy to disable/enable said layout constraint on-the-fly.

To create a second layout set for a view controller which I can then programmatically enable/disable (via an IBOutletCollection of NSLayoutConstraints for both sets) , I'll need to disable my already defined layout constraints in interface builder.

Let me clear here I do NOT want to delete them, just disable them so that i can design a second set without interface builder complaining all the time about mismatching constraints. Furthermore switching size classes is not an option, since the layout sets are meant for one and the same size class.

Is there an option to do so?

Thanks in Advance

Malte

Further Information: SDK Version: 8.1 Deployment Target 8.0


Solution

  • Select the constraint you want to disable in storyboard, and Option+Command+4 to show Attributes Inspector, then unselect Installed.