small medium large xlarge

01 Jun 2012, 06:47
MARK JACKSON (5 posts)

How to implement the Retina display in Application?

01 Jun 2012, 13:14
Chris Adamson (345 posts)

It’s mostly taken care of for you. Anytime you use the default UIKit views, you’ll automatically get a retina version. Text is also always rendered at retina resolution. And if you create a custom UIView and override drawRect, all the custom drawing you do with Core Graphics will be drawn at retina resolution (you just have to remember that in CG you are drawing with resolution-independent points).

Largely the only thing you have to do that’s special is that if you use PNG or JPEG graphics, you should supply a double-resolution version with a “@2x” at the end of the name. So, for example in the “AudioRecorderPlayer” example where we have a 60x60 PlayButton.png, you’d also want to put a 120x120 PlayButton@2x.png in the project.

See points versus pixels in Apple’s online docs.

04 May 2015, 12:47
Nupur Garg (7 posts)

var isRetina = ( window.devicePixelRatio > 1 || (window.matchMedia && window.matchMedia(“(-webkit-min-device-pixel-ratio: 1.5),(-moz-min-device-pixel-ratio: 1.5),(min-device-pixel-ratio: 1.5)”).matches) );

You must be logged in to comment