3

I have written code to get the screen resolution like this.

 CGRect screenRect = [[UIScreen mainScreen] bounds];
 CGFloat screenWidth = screenRect.size.width;
 CGFloat screenHeight = screenRect.size.height;

The result of IPAD Air is like this for above code.

screenWidth is ------->>> 1024.000000 screenHeight is ------->>> 768.000000

But the actual size is this 2048×1536.

Kindly someone help me out for this problem.

Thanks in advance.

Kiran Kumar
  • 677
  • 3
  • 17
  • 1
    The screen size is reported in points, not pixels. You need to get the scale and multiple by that to get the pixel size of the screen. – zaph May 06 '15 at 10:46

1 Answers1

3

It's because of Retina screen. The actual screen size is presented in points (not pixels). Retina displays got higher (2x) pixels density therefore to get screen's size in pixels you have to multiply it by [UIScreen mainScreen].scale. This scale factor equals 1 for normal displays and 2 for retina.

Artrmz
  • 340
  • 2
  • 14