Reputation: 10226
I have a UIButton that has the following constraints:
I set these constraints and added the button in Storyboard.
How can I programmatically change the frame of the button?
I tried this, but it didn't have any effect:
goodButton.frame = CGRectMake(0, 0, 200, badButton.bounds.size.height)
Upvotes: 0
Views: 460
Reputation: 7466
When you say constraints, do you mean AutoLayout constraints? In autoLayout it doesn't make sense to modify the frame of the button anymore.
The changes in the frame must be dealt with through autoLayout constraints. You need to create a reference to constraints (they are objects) ..and modify their .value property accordingly.
CORRECTION: .constant property
Upvotes: 1