Duaan
Duaan

Reputation: 609

UIButton size is not as set in xib

I made UIButton with Type Custom in Interface Builder like below

XIB in Interface Builder

and its dimensions are

Dimensions in Interface Builder

But, when I run it on Ratina 4 Simulator,it show smaller

Simulator Result

Why is it showing like this, not like as was set in xib.

Upvotes: 3

Views: 630

Answers (2)

Kepler
Kepler

Reputation: 705

It's because you use auto layout. You can:make your button IBOutlet, connect with your UIButton object (shareBut for example) in code and write:

shareBut.autoresizingMask=UIViewAutoresizingNone;

Or you can add width constraint to your button in IB (look this tutorial).

Upvotes: 2

Levi
Levi

Reputation: 7343

The button might be larger, but you see only the image with it's original size. Try a larger image or set this one as background image (however in this case you can loose from the quality of the image)

Upvotes: 0

Related Questions