Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone 4 incorrect screen size?

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);
like image 867
carloe Avatar asked Jun 27 '26 21:06

carloe


1 Answers

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

like image 165
Tom H Avatar answered Jun 30 '26 21:06

Tom H



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!