Reputation: 1608
I want to learn if there's a way to delete AND create a constraint
So I have greenTop constrained to viewTop, purpleTop to greenBottom etc...
I want to be able to delete greenTop-viewTop
constraint, delete purpleTop-greenBottom
...and create a new purpleTop-viewTop
constraint and a greenTop-blackBottom
. (programmatically)
Effectively moving green to bottom and all others shift up one space.
Note: I know i could just make each constrained to topView and adjust, but I'd like to learn this way.
Upvotes: 0
Views: 51
Reputation: 104082
Sure, you can do that. You can make an IBOutlet to a constraint just like any other object. Call removeConstraint
on the owner of that constraint to remove it,
someView.removeConstraint(someConstraint) // someConstraint is an IBOutlet
You cannot change the items or a relationship in a constraint, so #2 will not work.
Upvotes: 1