Detect which device you are using has become, by now, fundamental to better manage their own app.
The times where everything was ‘simple’ are over, now we have to optimize as much as possible for every device you use.
For this there are some API where it is possible to detect which device is currently in use and if it has Retina Display:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
if([[UIDevice currentDevice]userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { //is iPhone if ([[UIScreen mainScreen] bounds].size.height == 568) //iPhone 5 else { if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2.0) //device with Retina Display else //no Retina Display } }else if([[UIDevice currentDevice]userInterfaceIdiom] == UIUserInterfaceIdiomPad) { //is iPad if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2.0) //device with Retina Display else //no Retina Display } |