How to differentiate between 3.5 and 4 inch iPhone
Open Xcode and create a new Single View Application. For product name, use DifferentiateIphoneSize and then fill out the Organization Name...

For demonstration purposes, add a label inside the view controller and change the text to "3.5-inch or 4-inch".
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { if ([[UIScreen mainScreen] scale] == 2.0) { if([UIScreen mainScreen].bounds.size.height == 568){ // iPhone retina-4 inch self.lbl_textOutput.text = @"iPhone retina-4 inch"; } else{ // iPhone retina-3.5 inch self.lbl_textOutput.text = @"iPhone retina-3.5 inch"; } } else { // not retina display self.lbl_textOutput.text = @"iPhone that's not retina display"; } }Build and Run, a label can be seen with text "iPhone retina-4 inch" if the app is run in with 4-inch size, otherwise "iPhone retina-3.5 inch".
You can download the source code of the DifferentiateIphoneSize at my repository on bitbucket.
Post a Comment