Is the iPhone 4 the wrong screen size?

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

 CGRect screenRect = [[UIScreen mainScreen] bounds];
 NSLog(@"Screen Size: %f, %f", screenRect.size.width, screenRect.size.height);
+3
source share
1 answer

This method returns the size in Points , not pixels. If you are a registered apple developer, I would suggest watching a WWDC video (new) on Retina display design. He has very useful information.

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

+8
source

Source: https://habr.com/ru/post/1751923/


All Articles