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

interface-builderiphoneuibuttonuikitxcode

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)

Best Answer

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.