Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

building stretchable Image in interface builder

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.

like image 853
ilteris Avatar asked Oct 14 '10 21:10

ilteris


3 Answers

This can be done in interface builder: http://www.slideshare.net/mystcolor/stretchable-images-in-uiimageview-using-ib-only

enter image description here

like image 149
William Entriken Avatar answered Sep 30 '22 16:09

William Entriken


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.

enter image description here

This answer was inspired by http://www.slideshare.net/mystcolor/stretchable-images-in-uiimageview-using-ib-only

like image 28
Victor Bogdan Avatar answered Sep 30 '22 14:09

Victor Bogdan


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)

like image 43
NoilPaw Avatar answered Sep 30 '22 14:09

NoilPaw