Search code examples
iosuikituiimageretina-display

Resizable UIImage and retina


I am not sure what middle size I should use for the stretchable part of a retina image. The document says:

During scaling or resizing of the image, areas covered by a cap are not scaled or resized. Instead, the pixel area not covered by the cap in each direction is tiled, left-to-right and top-to-bottom, to resize the image. This technique is often used to create variable-width buttons, which retain the same rounded corners but whose center region grows or shrinks as needed. For best performance, use a tiled area that is a 1x1 pixel area in size.

But aren't retina images supposed to be 2x the size of non-retina images? If so, shouldn't the middle be 1x1 point == 2x2 pixel?


Solution

  • Both 1x1 pixel and 2x2 pixel areas will work. 1x1 may get you more performance as per docs, but 2x2 is much more convenient for scaling down retina size resources.