Detecting iPhone 6/6+ screen sizes in point values

前端 未结 16 2358
独厮守ぢ
独厮守ぢ 2020-11-29 15:44

Given the newly announced iPhone 6 screen sizes:

iPhone 6: 1334h * 750w @2x (in points: 667h * 375w)
iPhone 6+: 1920 * 1080 @3x (in points: 640h * 360w)
         


        
16条回答
  •  余生分开走
    2020-11-29 16:04

    Hannes Sverrisson's answer is almost correct. The iPhone 6 coordinate system is in fact larger than the 5s Using his code:

    UIScreen *mainScreen = [UIScreen mainScreen];
    NSLog(@"Screen bounds: %@, Screen resolution: %@, scale: %f, nativeScale: %f",
          NSStringFromCGRect(mainScreen.bounds), mainScreen.coordinateSpace, mainScreen.scale, mainScreen.nativeScale);
    

    The coordinate system for apps providing the correct launch images are:

    Size for iPhone 6 (Retina HD 4.7) with @2x scaling, Coordinate space: 375 x 667 and 750 x 1334 actual points:

    Screen bounds: {{0, 0}, {375, 667}}, Screen resolution: >, scale: 2.000000, nativeScale: 2.000000
    

    Size for iPhone 6 Plus (Retina HD 5.5) with @3x scaling, Coordinate space: 414 x 736 and 1242 x 2208 actual points:

    Screen bounds: {{0, 0}, {414, 736}}, Screen resolution: >, scale: 3.000000, nativeScale: 3.000000
    

提交回复
热议问题