You can see here that the iPhone 5 and iPhone5s have the same length of screen.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { CGSize result = [[UIScreen mainScreen] bounds].size; if (result.height == 480) { // 3.5 inch display - iPhone 4S and below NSLog(@"Device is an iPhone 4S or below"); } else if (result.height == 568) { // 4 inch display - iPhone 5 NSLog(@"Device is an iPhone 5/S/C"); } else if (result.height == 667) { // 4.7 inch display - iPhone 6 NSLog(@"Device is an iPhone 6"); } else if (result.height == 736) { // 5.5 inch display - iPhone 6 Plus NSLog(@"Device is an iPhone 6 Plus"); } } else if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { // iPad 9.7 or 7.9 inch display. NSLog(@"Device is an iPad."); }So it is pretty easy, right? If you find this post helpful, please share and subscribe.
Post a Comment