Search code examples
ios9xcode7frameuistoryboard

label frame not changing programmatically which is added in storyboard


Can anybody tell me how to change frame of any controls programmatically which is added in storyboard for iOS 9.

Currently, mylable frame which is in storyboard inside UIView.

mylabel.frame = CGRectMake(0, 45, 290, 30)

I need to change frame of mylabel on button's action method.

mylabel.frame = CGRectMake(0, 80, 290, 100)

But, it didn't change.


Solution

  • Its because You have added autolayout constraint into the control thats why it is automatically resizing . If you want to set frame programmatically then better to remove constraint and then creating iboutlet and doing same way ..it will work.

    Thanks.