I'm trying to resize a UIButton in my iPhone app. I have a UIButton synthesized and when I call the following code, it moves on the screen, but the width & height of the button never change.
button.frame.size = CGRectMake(104, 68, 158, 70);
For example, when I change the height (70) to 40, the height of the button does not change. If I change the x or y, however, it will move on the screen.
Any ideas?
To change the size of the Button you do:
[button setFrame:CGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height)];
example
[button setFrame:CGRectMake(173, 269, 130, 44)];
Make sure that the check box "Use Autolayout" is not set in the Xib file or Storyboard. If the option is set then the command does not work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With