I am trying to build a stretchable image in interface builder. Is this even possible? I have searched the web and cannot come up with a proper solution. I'd appreciate any answers.
This can be done in interface builder: http://www.slideshare.net/mystcolor/stretchable-images-in-uiimageview-using-ib-only
If you mean you already have a stretchable image, you can use the Stretching feature of IB. The X and Y values seem to be the positions for the stretch starting point, relative to the entire width and height of the image, i.e. 0.5 would mean a point in the middle of the image.
Same thing for the Width and Height: sizes for the stretchable area, relative to the image size, i.e. setting it to a value of 1 / imageWidth would mean the stretchable area is 1 pixel wide. The strange thing is 0 also work fine for the blue pill button (could be for convenience reasons?).
Below, view modes are set to "Scale to Fill". The images are stretchable images from https://github.com/0xced/UIKit-Artwork-Extractor.
This answer was inspired by http://www.slideshare.net/mystcolor/stretchable-images-in-uiimageview-using-ib-only
With iOS7 you now have the option to use slicing within the Xcode5 xcassets catalogue. Then the stretching will be done for you when you add the sliced image. (see official documentation)
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