Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install/Uninstall constraint programmatically [closed]

Is there a way to install and uninstall an Xcode interface builder constraint programmatically?

enter image description here

like image 332
Eric Avatar asked May 28 '15 00:05

Eric


1 Answers

Connect the IBOutlet for the NSLayoutConstraint by CTRL+click the constraint and drag it to the viewController (for ex. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraint;).

For removing the constraint:

[self.view removeConstraint:constraint]

for installing the constraint:

[self.view addConstraint:constraint]
like image 119
A C Avatar answered Oct 22 '22 17:10

A C