The device screen will be the first screen, but new phones require launch pictures to be added first; otherwise, older apps will run in Zoomed Mode: The code I used to check this out is shown below. Note that iOS 8 and later is required for this to function.
UIScreen *mainScreen = [UIScreen mainScreen];
NSLog(@"Screen bounds: %@, Screen resolution: %@, scale: %f, nativeScale: %f",
NSStringFromCGRect(mainScreen.bounds), mainScreen.coordinateSpace, mainScreen.scale, mainScreen.nativeScale);
Code for detecting iPhone 6 Plus:
#define IS_PAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_PHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
-(BOOL)iPhone6PlusDevice{
if (!IS_PHONE) return NO;
if ([UIScreen mainScreen].scale > 2.9) return YES; // Scale is only 3 when not in scaled mode for iPhone 6 Plus
return NO;
}
or
-(BOOL) iPhone6PlusUnZoomed{
if ([self iPhone6PlusDevice]){
if ([UIScreen mainScreen].bounds.size.height > 720.0) return YES; // Height is 736, but 667 when zoomed.
}
return NO;
}
Relying on.nativeScale will not work if you are adjusting the user interface for the iPhone 6 Plus since the results from the simulator and the actual device differ. because of the remark underneath. Due to the fact that scale is a CGFloat, programmes shouldn't check for equality since some float values may never be equal.
The new iPhone sizes can be used after installing Launch Screen; otherwise, your app will still seem scaled.
updated for the release of the new iPhones 11, 11, Pro, and 11 Pro Max
The physical dimensions of the iPhone 11 Pro Max are 3.06 x 6.22 in (77.8 x 158.0 mm) and 414 x 896 points and 1242 x 2688 pixels, respectively, in coordinate space. Super Retina XDR display of 6.5".
For iPhone, size 11, the physical dimensions of the device are 2.81 x 5.67 in (71.4 x 144.0 mm) and 375 x 812 points and 1125 x 2436 pixels, respectively, with @3x scaling for the 11 Pro. Display size: 5.8" Super Retina XDR.
Size for the iPhone 11 is 2.98 x 5.94 inches (75.7 x 150.9 mm) with @2x scaling, coordinate space: 414 x 896 points and 828 x 1792 pixels, 326 ppi. Liquid Retina HD display, 6.1".
The physical dimensions of the iPhone XS Max are 3.05 x 6.20 in (77.4 x 157.5 mm) with @3x scaling (Apple name: Super Retina HD 6.5 display), coordinate space: 414 x 896 points and 1242 x 2688 pixels, 458 ppi.
let screen = UIScreen.main
print("Screen bounds: \(screen.bounds), Screen resolution: \(screen.nativeBounds), scale: \(screen.scale)")
//iPhone X🅂 Max Screen bounds: (0.0, 0.0, 414.0, 896.0), Screen resolution: (0.0, 0.0, 1242.0, 2688.0), scale: 3.0
The physical dimensions of the iPhone XR are 2.98 x 5.94 in (75.7 x 150.9 mm) with @2x scaling (Apple name: Super Retina HD 6.1" display), coordinate space: 414 x 896 points and 828 x 1792 pixels, 326 ppi.
let screen = UIScreen.main
print("Screen bounds: \(screen.bounds), Screen resolution: \(screen.nativeBounds), scale: \(screen.scale)")
//iPhone X🅁 Screen bounds: (0.0, 0.0, 414.0, 896.0), Screen resolution: (0.0, 0.0, 828.0, 1792.0), scale: 2.0
The physical dimensions of the device are 2.79 x 5.65 in (70.9 x 143.6 mm) for the iPhone XS and iPhone X with @3x scaling (Apple name: Super Retina HD 5.8" display), coordinate space: 375 x 812 points and 1125 x 2436 pixels, 458 ppi.
let screen = UIScreen.main
print("Screen bounds: \(screen.bounds), Screen resolution: \(screen.nativeBounds), scale: \(screen.scale)")
//iPhone X🅂 and X Screen bounds: (0.0, 0.0, 375.0, 812.0), Screen resolution: (0.0, 0.0, 1125.0, 2436.0), scale: 3.0
Screen physical dimension is 2.7 x 4.8 in or 68 x 122 mm for the iPhone 8, 7, 6 Plus, and iPhone 8, 7S Plus with @3x scaling (Apple name: Retina HD 5.5), Coordinate space: 414 x 736 points and 1242 x 2208 pixels, 401 ppi.
Screen bounds: {{0, 0}, {414, 736}}, Screen resolution: <UIScreen: 0x7f97fad330b0; bounds = {{0, 0}, {414, 736}};
mode = <UIScreenMode: 0x7f97fae1ce00; size = 1242.000000 x 2208.000000>>, scale: 3.000000, nativeScale: 3.000000
Screen physical dimension is 2.3 x 4.1 in or 58 x 104 mm for the iPhone 6 and iPhone 6S with @2x scaling (Apple name: Retina HD 4.7), Coordinate space: 375 x 667 points and 750 x 1334 pixels, 326 ppi.
Screen bounds: {{0, 0}, {375, 667}}, Screen resolution: <UIScreen: 0x7fa01b5182d0; bounds = {{0, 0}, {375, 667}};
mode = <UIScreenMode: 0x7fa01b711760; size = 750.000000 x 1334.000000>>, scale: 2.000000, nativeScale: 2.000000
When compared to the iPhone 4, the iPhone 5 has a resolution of 640 x 1136.
Upload LaunchImages to avoid the programme running scaled and failing to display proper scaling or screen sizes.