Skip to content

Instantly share code, notes, and snippets.

@priore
Last active February 28, 2016 02:54
Show Gist options
  • Save priore/1b654a0ebc252f901490 to your computer and use it in GitHub Desktop.
Save priore/1b654a0ebc252f901490 to your computer and use it in GitHub Desktop.
Detect the type of iPhone Device independent from iOS version
// 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