Last active
February 28, 2016 02:54
-
-
Save priore/1b654a0ebc252f901490 to your computer and use it in GitHub Desktop.
Detect the type of iPhone Device independent from iOS version
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
| // Detect the type of iPhone Device independent from iOS version | |
| CGSize size = [UIScreen mainScreen].bounds.size; | |
| CGFloat r = size.width > size.height ? size.width / size.height : size.height / size.width; | |
| if (r < 1.5) { | |
| // iPad | |
| } else if (r == 1.5) { | |
| // iPhone 4 | |
| } else if (r > 1.5) { | |
| // iPhone 5/6/6+ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment