Created
April 16, 2013 07:00
-
-
Save syxc/5393921 to your computer and use it in GitHub Desktop.
How to check iPhone Device Version in iOS?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // via http://stackoverflow.com/a/13068238/1242183 | |
| #define HEIGHT_IPHONE_5 568 | |
| #define IS_IPHONE ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) | |
| #define IS_IPHONE_5 ([[UIScreen mainScreen] bounds ].size.height == HEIGHT_IPHONE_5 ) | |
| // then just check whenever you needs.. | |
| if (IS_IPHONE_5) { | |
| // Code for iPhone5 | |
| } else { | |
| // Code for earlier version | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IOS SDK Check if device is an iPhone or iPad at runtime
This is the code i use to check if the user device is an iPhone, iPhone4 or IPad. Based on this i show different screens.
// check the device type - iphone / ipad / ipod / whatever if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES && [[UIScreen mainScreen] scale] == 2.00) { // RETINA DISPLAY CODE } else { // NON RETINA DISPLAY CODE } } else { // IPAD CODE HERE }via http://www.adriancoroian.com/programming-ios-sdk-check-if-device-is-an-iphone-or-ipad-at-runtime/