Created
January 31, 2013 22:51
-
-
Save timbergus/4687430 to your computer and use it in GitHub Desktop.
This code initialize the different sizes of the iPhone/iPad screens to do something depending on which device we are using.
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
| UIDevice *device = [[UIDevice alloc] init]; | |
| if ([device.model isEqualToString:@"iPhone"] || [device.model isEqualToString:@"iPhone Simulator"]) { | |
| if ([[UIScreen mainScreen] bounds].size.height == 480) { | |
| // Do something with the iPhone | |
| } | |
| if ([[UIScreen mainScreen] bounds].size.height == 568) { | |
| // Do something with the iPhone5 | |
| } | |
| } | |
| if ([device.model isEqualToString:@"iPad"] || [device.model isEqualToString:@"iPad Simulator"]) { | |
| // Do something with the iPad | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment