I have found the solutions from here: Determine device (iPhone, iPod Touch) with iPhone SDK
From the link, it suggests to use the library https://gist.github.com/1323251
But obviously the library is quite outdated. I couldn't find the iPhone 5 and new iPad and etc in the list.
Does anyone know how can I find the completed and updated list?
Thank you so much.
Just adding to @Mohammad Kamran Usmani answer. More specific iPhone types:
@import UIKit;
//Check which iPhone it is
double screenHeight = [[UIScreen mainScreen] bounds].size.height;
if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
{
NSLog(@"All iPads");
} else if (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPhone)
{
if(screenHeight == 480) {
NSLog(@"iPhone 4/4S");
smallFonts = true;
} else if (screenHeight == 568) {
NSLog(@"iPhone 5/5S/SE");
smallFonts = true;
} else if (screenHeight == 667) {
NSLog(@"iPhone 6/6S");
} else if (screenHeight == 736) {
NSLog(@"iPhone 6+, 6S+");
} else {
NSLog(@"Others");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With