views:

339

answers:

1

Could someone tell me why the following code would return Screen Size: 320.000000, 480.000000 on the iPhone 4?

 CGRect screenRect = [[UIScreen mainScreen] bounds];
 NSLog(@"Screen Size: %f, %f", screenRect.size.width, screenRect.size.height);
+6  A: 

That method returns a size in Points, not Pixels. If you are a registered apple developer, I would suggest watching the WWDC (new) video on designing for the Retina display. It has a load of really useful information.

UIKit uses points, however OpenGL uses pixels. UIViews now have a contentScaleFactor property, which will be 2 on iPhone 4, and 1 on everything else so far...

Tom H