开发者

Screen Resolutions and Frame Size?

开发者 https://www.devze.com 2023-01-16 08:19 出处:网络
I am curious about how the iPhone4 works out the size of frame开发者_开发问答 items, for example:

I am curious about how the iPhone4 works out the size of frame开发者_开发问答 items, for example:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    MyController *tempController = [[MyController alloc] init];
    [[tempController view] setFrame:CGRectMake(0.0,20.0,320.0,460.0)];
    [self setMyController:tempController];
    [tempController release];
    ...

this fills the whole screen of both the iPhone3_sim, iPhone4_sim & iPhone4_device? I was sort of expecting to have to double the dimensions for iPhone4, is there some sort of auto app scaling (doubling) that comes into play, and if so how do you set/change that?

Cheers Gary


The iPhone 4 and newest iPod Touch (and presumably future Retina Display devices) use a "virtual points" system that doesn't map directly to pixels. When you talk about pixel positions on the retina display, you're really talking about these "points". It has as many points as the older displays had pixels. All of this is transparent to the developer, so your code will magically just do the right thing on the different display types. Pretty nice.


Physical resolution and the coordinate 320 x 480 is not same. That is 1 logical coordinate point is not necessarily same of 1 actual pixel. This transformation is transparent to the developers. This is similar to that in OpenGL you can have a 600 x 500 window but set a coordinate system where x runs to -10.0 to 10.0 and y runs to -100.0 to 100.0. The coordinate point is transformed to actual pixel position by the system.

0

精彩评论

暂无评论...
验证码 换一张
取 消