Category to detect if an iPhone has a 4" screen (is an iPhone5)
It's better to use AutoLayout to adapt the screens of your app to the iPhone 5, but for those legacy apps that can not be fully migrated to this new API you can use this snippet to detect if the device is an iPhone 5 and adjust the objects in the screen.
@implementation UIDevice (ScreenSizeAdittions)
- (BOOL)has4InchesScreen { CGRect screenBounds = [[UIScreen mainScreen] bounds]; return screenBounds.size.height == 568.f; }
@end
Written by Erick Camacho
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ios
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#