I am currently stuck with a very weird problem. I am using iOS 6 and Xcode 4.5. I have a storyboard with a UIViewController
and a UIButton
in it. I
I had the same weird problem using XCode 4.5 and iOS 6 as deployment target. I am not using story board though. I managed to solve it by disabling the option "Use Autolayout" in the Interface Builder. (In the file inspector->Interface builder document.
Hope this helps
You can change frame of your UIButton by changing layer's frame of UIButton
[self.button.layer setFrame:]
import QuartzCore framework in your class header before using this. This will work with auto layout also.
Remove the view from the superview and after setting frame add this view again as a subview. Hope this will work fine...
//Remove the view from the superview
UIView *view = yourButton.superview;
[yourButton removeFromSuperview];
//change frame of UIButton
CGRect bounds = view.bounds;
yourButton.center = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));
//add this view again as a subview
[view addSubview:yourButton];
You can use this
[_button setTranslatesAutoresizingMaskIntoConstraints:YES];
after this you can set frame of your button.
It may give some warnings in log about constraints, as this property override constraints you gave in autolayout.