I'm trying to set up an UIButton background using a stretchable image in Interface Builder. Button is configured as "custom" and I have assigned a background image to it. The view mode is set to "Scale to Fill", but when I set any value in "Stretching" area it doesn't seems to do anything.
I have tried doing it programmatically and it works using the UIImage's stretchableImageWithLeftCapWidth:topCapHeight:
message, but its use is not recommended by Apple.
Is there any way to make it work from Interface Builder?
Unfortunately, you can't use stretchable/resizable images in the current version of Xcode 4. You have to do it programmatically.
Assuming that you are talking about iOS 5: the SDK is still under NDA for a few days, so I can't be more specific. But just as a hint:
Apple doesn't discourage the use of stretchableImageWithLeftCapWidth:topCapHeight:
. If you look at the documentation (iOS 5 version) of this method again, you will find an answer there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With