views:

45

answers:

2

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

+2  A: 

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.

Dan Ray
Many thanks, do you know off hand where this is described in the docs?
fuzzygoat
@fuzzygoat Right here: https://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/SupportingResolutionIndependence/SupportingResolutionIndependence.html
Dan Ray
+1  A: 

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.

taskinoor