3

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);

1 Answer 1

8

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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.