Reputation: 555
I have a UIButton in my Xcode project that has constraints(see image #3). The height and width are both set to 80 but when I run the project it looks like bigger than what it is set to. (See image #2)
In the .m file, it is set 80x80 as well (objective-c)
openMenu.layer.frame = CGRectMake(self.view.center.x - 27, self.view.frame.size.height - 80, 80, 80);
It should look like:
Image #1
Image #2
Image #3
Note: Those are the actual sizes (it is fit to scale)
Why is it big like image #2 and how do I fix it so it stay 80x80 like image #1?
Upvotes: 0
Views: 139
Reputation: 1326
trying to add hieght
and width
fix constraint hope this will help.
Upvotes: 1
Reputation: 101
This will resize the button image to your desired size adding margins to it.
[openMenu setImageEdgeInsets:UIEdgeInsetsMake(25, 25, 25, 25)];
Upvotes: 0
Reputation: 1964
You should also set width
and height
constrains in Interface Builder.
Upvotes: 1