I wonder if anyone can help me with following. I have written a Quartz 2d ap and have used the following code to get the correct scale factor for each device :
if ([UIScreen instancesRespondToSelector:@selector(scale)])
{
return [[UIScreen mainScreen] scale];
}
else
{
return 1.0;
}
I then multiply all values by this scale mulitplier in my code. The problem I have is that the app does not display propertly in x2 mode on the ipad - everything is two times too big. Can anybody help me ?
Thanks,
Martin
The scale factor is related to the Retina displays on the newer iPhones and iPod touches, not the 2X scaling setting on the iPad. In fact, the UIScreen scale
property you are referencing does not exist on the iPad's current 3.2 OS version, only on 4.0+. On the current iPads running the OS 4.2 beta, it should always return 1.0.
The problem you are experiencing with Quartz drawing in the 2X mode must come from somewhere else. Do you do any device-specific checks for any elements in your code?
I am not sure if this is your problem, but you seem to want to test the UIScreen for the selector scale. Which it will never have. That selector works only on [UIScreen mainScreen].
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
{
return [[UIScreen mainScreen] scale];
}
else
{
return 1.0;
}
Although, this mistake would let you think that it would always return a scale of 1.0.
来源:https://stackoverflow.com/questions/3873868/problem-adapting-scale-factor-for-ipad-x2-compatibility-mode