문제

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);
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top