I just wanted to know if my image has x*y dimensions.
When retina display devices show that image created with a CGRectMake(0,0,x,y), would that be a pixelated image?
Should the correct size have been CGRectMake(0,0,x/2,y/2)?
How can I tell the rect size that an image should have?
Do I need to use the contentScaleFactor = [UIScreen mainScreen].scale;?
or maybe divide by it as in: CGRectMake(0,0,x/contentScaleFactor,y/contentScaleFactor)?
Dimensions are measured in points instead of pixels. Both retina and non-retina display devices have the same points. On a non-retina display device, one point equals one pixel, but on a retina display device, one point equals two pixels. So, you will use
CGRectMake(0,0,x,y)for both.To avoid a pixelated image, make sure to provide a double-resolution image with the
@2xsuffix. For example, if your regular image was namedfoo.png, then the retina version should be namedfoo@2x.png.When coding, refer to
foo.pngat all times. When your app is running on a retina display device the double-resolution image (foo@2x.png) will be used automatically.