addbq2
addbq2

Reputation: 53

AutoLayout button with image is resized to actual image size

So, using Objective C, I have a button to post to Twitter. I saved the image and placed it in my supporting files. I have the button looking like this: https://i.sstatic.net/CQyxS.png in the storyboard.

But when I go to simulate the app with iOS simulator for it ends up looking like this: https://i.sstatic.net/B8ueV.png

It seems to revert back to the size of the actual image no matter what. I can't seem to see a way to make it the size of the button. Unless is there a way to programmatically do it? Probably missing like, a checkbox somewhere.

I'm sorry about posting the links instead of using images: have like, 1 reputation.

Upvotes: 2

Views: 748

Answers (1)

bilobatum
bilobatum

Reputation: 8918

Presumably you don't have any explicit constraints that are dictating the size of your button. The size of your button is being dictated by the button's intrinsic content size. In this case, that content size is the image size.

Either resize your image (e.g., programmatically or in your favorites graphics program), or install explicit constraints on the button that dictate the button's size. The constraints could be installed in IB by control-dragging with zero code.

Upvotes: 3

Related Questions