iphone - Detect Retina Display -
iphone - Detect Retina Display -
does ios sdk provides easy way check if currentdevice has high-resolution display (retina) ?
the best way i've found :
if ([[uiscreen mainscreen] respondstoselector:@selector(scale)] == yes && [[uiscreen mainscreen] scale] == 2.00) { // retina display }
in order observe retina display reliably on ios devices, need check if device running ios4+ , if [uiscreen mainscreen].scale
property equal 2.0. cannot assume device running ios4+ if scale
property exists, ipad 3.2 contains property.
on ipad running ios3.2, scale homecoming 1.0 in 1x mode, , 2.0 in 2x mode -- though know device not contain retina display. apple changed behavior in ios4.2 ipad: returns 1.0 in both 1x , 2x modes. can test in simulator.
i test -displaylinkwithtarget:selector:
method on main screen exists in ios4.x not ios3.2, , check screen's scale:
if ([[uiscreen mainscreen] respondstoselector:@selector(displaylinkwithtarget:selector:)] && ([uiscreen mainscreen].scale == 2.0)) { // retina display } else { // non-retina display }
iphone ios4 retina-display
Comments
Post a Comment