0

I added this statement to ViewDidLoad:

NSLog(@"Screen resolution: (%f, %f)", self.view.frame.size.width, self.view.frame.size.height);

Here's the result I get when the "Device" property of the simulator is "iPhone":

Screen resolution: (320.000000, 548.000000)

Same thing when I set it to "iPhone (Retina 4-inch)":

Screen resolution: (320.000000, 548.000000)

But why? Isn't the screen resolution supposed to be different?

Sergey
  • 47,222
  • 25
  • 87
  • 129

2 Answers2

2

This is because the resolution is printed in points and not in pixels

For the retina display 1 point = 2 pixels

For the regular display 1 point = 1 pixel

gsach
  • 5,715
  • 7
  • 27
  • 42
0

You should use UIScreen to check for the screen resoultion :

[[UIScreen mainScreen] bounds].size.height
[[UIScreen mainScreen] bounds].size.weight

And as other answers here mention resolution is measured in points and not pixels.

giorashc
  • 13,691
  • 3
  • 35
  • 71
  • This is not what he asks. As long as the height is 548.000000 he is printing the correct height – gsach Jul 16 '13 at 10:51
  • @GeorgeSach in his log he writes screen resolution... Not all views are defined with the screen size and might produce what seems to be an incorrect result. He also did not state what he was expecting to be the resolution (maybe he knows about the points/pixel resolution) and resolution height between iPhone 4-inch retina and iPhone should be different – giorashc Jul 16 '13 at 10:54