Search code examples
iphonexcodestoryboardscaleresolution

xcode: storyboard Auto Pixel to Point Conversion?


When applying Retina 4 for the storyboard, it would give a resolution of 320points-by-480points which is 640-by-960 in pixels.

However, when adding an image for an UIView or an UIButton by dragging it from the Media library into the VC, [not programmatically]

let's say, the image has a resolution of 50-by-50 in pixels,

instead of appearing 25points-by-25points in the storyboard,

it would appear 50points-by-50points.

Is it possible to set the the conversion from pixel to point to be triggered automatically instead of having to compress the image to half later on?


Solution

  • Yes - the image filename must have @2x at the end, so interface builder knows it is a retina asset. You should also include a non- retina version with the plain filename.