KeepLayout icon indicating copy to clipboard operation
KeepLayout copied to clipboard

Removing a constraint

Open ClarisseL opened this issue 13 years ago • 6 comments

I couldn't find any way to remove a constraint :p Is it even possible ?

ClarisseL avatar Mar 11 '13 13:03 ClarisseL

No, I don't have methods for this and there is not any way to access them. You will have to create the constraint “manually” or search for specific constraint in the constraints property of given view.

Tricertops avatar Mar 11 '13 15:03 Tricertops

Awww too bad ! thanks anyway :)

ClarisseL avatar Mar 11 '13 15:03 ClarisseL

I will improve whole concept of this KeepLayout in next major version. Modifying and removing constrains will be possible.

Tricertops avatar Mar 11 '13 15:03 Tricertops

it's gonna be awesome then :p ! Because that's really something that's missing !

ClarisseL avatar Mar 11 '13 16:03 ClarisseL

Has this been added to KeepLayout?

simonsmiley64 avatar Aug 25 '17 06:08 simonsmiley64

Yes, of course. Just call -deactivate on any attribute like this:

// This creates 3 layout constraints:
view.keepWidth.equal = 150 +keepLow;
view.keepWidth.min = 100;
view.keepWidth.max = 200;

// This modifies existing constraint (created above):
view.keepWidth.min = 110;

// This removes all 3 layout constraints:
[view.keepWidth deactivate];

Tricertops avatar Aug 25 '17 08:08 Tricertops