UIScreen and scale
I was dealing with handling retina display in a project. According to the programming guide, I should change whether the screen is retina display or not by checking:
[[UIScreen mainScreen] scale]
that if scale is 2.0 it is retina display, if it is 1.0 it is normal display.
According to the document:
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/...
It should be available after OS 4.0. So I assume that:
[UIScreen respondToSelector:@selector(scale)]
should be enough to check if the current system supports the image creation function UIGraphicsBeginImageContextWithOptions.
The document is actually wrong, that in iOS 3.2, [[UIScreen mainScreen] scale] is available. Even worse, if you app is in iPhone mode, the return value depends on whether your app is now in 1x mode or 2x mode. So if the iPhone app is in 2x mode, it actually will return 2.0 that make you think it is a retina display!

最新回應
32 周 4 天前
37 周 5 天前
41 周 1 天前
42 周 1 天前
50 周 6 天前
50 周 6 天前
51 周 18 小時前
51 周 2 天前
1 年 6 天前
1 年 1 周前