I'm getting a bit confused on how to use the simulator to build applications that need to support the new higher resolution of the iphone 4.
I would except when selecting the iphone4 simulator to run the app on that [[UIScreen mainScreen] bounds]
would give me 960x640 back, but instead it still giving me the old resolution (480x320) ?
Although the iphone4 simulator appears as a giant phone on my screen, it appears that it still consists of only 480x320 pixels. For instance when I would want to display something on line 700, it'll just fall ofscreen ?
Thanks for any input on this.
UIScreen has a new scale
method. Multiply the bounds.size by the scale to get the pixels. You can think of unscaled values as being points, or virtual pixels.
Note that UIScreen has had a scale method since at least 3.2 but it has only been documented since 4.0 so respondsToSelector will trick you. I check UIImage for scale even when I want to know about UIScreen.
UIScreen *mainScreen = [UIScreen mainScreen];
CGFloat scale = [mainScreen scale];
CGRect bounds = [mainScreen bounds];
CGRect pixels = bounds;
if ( scale > 0 ) {
pixels.origin.x *= scale;
pixels.origin.y *= scale;
pixels.size.width *= scale;
pixels.size.height *= scale;
}