How to check that device is iPhone 5

There is no function in iOS 6 that can tell us that app is running on device with tall screen. So we have to check device’s screen size manually.

 

+ (BOOL) isTallScreen {
CGFloat height = [UIScreen mainScreen].bounds.size.height;
CGFloat scale = 1;
if ([ [UIScreen mainScreen] respondsToSelector: @selector(scale)] == YES) {
scale = [ [UIScreen mainScreen] scale];
}

return ( (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) && ( (height * scale) >= 1136) );
}
Scroll to Top

Discover more from CODE t!ps

Subscribe now to keep reading and get access to the full archive.

Continue reading