问题
When testing on my iPad 3,
[[UIScreen mainScreen] scale] == 1.0
My understanding is that this should be 2.0.
I am using the iOS 5.1 SDK with Xcode 4.2 on Snow Leopard, which I understand is not an "officially supported" configuration. However, I can't imagine why that would affect what is happening purely on the device. (I can imagine all sorts of ways it would break the simulator.)
回答1:
Before XCode version 4.3, [UIScreen scale] will return 1.0 for an iPad 3. Updating to 4.3 will enable the correct value of 2.0 being returned.
回答2:
That's because the screen is not scaled. You can get the ratio like this:
[[CCDirector sharedDirector] winSize].width/[[CCDirector sharedDirector] winSizeInPixels].width
If this is equal to 1 then you are on a non-retina device. Otherwise , if 2 , on a retina display. Also , don't forget to enable retina support.
Regards,
George
来源:https://stackoverflow.com/questions/11117041/why-is-uiscale-mainscreen-scale-1-on-an-ipad-3-with-xcode-4-2