Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interface Builder (iPhone dev) custom button background Image does not respect Stretching settings

I'm attempting to create a custom button using a background image in Interface Builder. The image has stretchable and non-stretchable parts so that it can be resized.

IB exposes the Stretching properties to allow for this, yet no values I put in affect how the button appears. It is always fully stretched to fill the size of the frame.

Is this this a unsupported feature in IB or in UIButton perhaps?

http://img.skitch.com/20100103-rjabkq2c2jkqynw47crxepdtwb.jpg

(Note: The above stretch values are not the ones that will work with the image properly, but just the values I was messing with at the time of the screenshot)

like image 548
David Whatley Avatar asked Jan 03 '10 23:01

David Whatley


1 Answers

In the example in Beginning iPhone 3 Development only the UIImage leftCapWidth and topCapHeight are used, and the image is created/set programmatically, so that's an alternate method if contentStretch isn't working.

like image 130
Nimrod Avatar answered Oct 23 '22 21:10

Nimrod