Created
September 13, 2014 19:02
-
-
Save eytanschulman/8668944bbe799ff90b4f to your computer and use it in GitHub Desktop.
Check for iPhone 3.5",4",4.7" or 5.5"
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
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { | |
CGSize result = [[UIScreen mainScreen] bounds].size; | |
if(result.height == 480) | |
{ | |
NSLog(@"Device is iPhone 4"); | |
} | |
if(result.height == 568) | |
{ | |
NSLog(@"Device is iPhone 5s"); | |
} | |
if (result.height == 667) { | |
NSLog(@"Device is iPhone 6"); | |
} | |
if (result.height == 736) { | |
NSLog(@"Device is iPhone 6 Plus"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you intend for this to be used as a snippet, I would replace the NSLogs with <#iPhone 4#>, <#iPhone 5s#>, etc, it'll show the Xcode placeholder instead of logging code that most people will delete anyway.