Open Xcode in addition to practice a novel Single View Application. For production name, utilisation DifferentiateIphoneSize in addition to thus fill upwards out the Organization Name in addition to Company Identifier alongside your customary values. Select iPhone for Devices.
For demonstration purposes, add together a label within the persuasion controller in addition to alter 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 { // non retina display self.lbl_textOutput.text = @"iPhone that's non retina display"; } }Build in addition to Run, a label tin move seen alongside text "iPhone retina-4 inch" if the app is operate inwards alongside 4-inch size, otherwise "iPhone retina-3.5 inch".
You tin download the root code of the DifferentiateIphoneSize at my repository on bitbucket.
0 komentar:
Please comment if there are any that need to be asked.