Install/Uninstall constraint programmatically [closed] Install/Uninstall constraint programmatically [closed] ios ios

Install/Uninstall constraint programmatically [closed]


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]


matomo