views:

2552

answers:

8

This is a programming question! Read on before you vote to close!

According to Apple, the iPhone 4 has a new and better screen resolution:

3.5-inch (diagonal) widescreen Multi-Touch display
960-by-640-pixel resolution at 326 ppi

This little detail affects our apps in a heavy way. Most of the demo apps on the net have one thing in common: They position views in the believe that the screen has a fixed size of 320 x 480 pixels. So what most -if not all- developers do is: They designed everything in such a way, that a touchable area is -for example- 50 x 50 pixels big. Just enough to tap it. Things have been positioned relative to the upper left, to reach a specific position on screen - let's say the center, or somewhere at the bottom.

Edit: It seems Apple has integrated an switch that allows to tell if an app is highRes or not. Nice.

When we develop high-resolution apps, they probably won't work on older devices. And if they do, they would suffer a lot from 4-times the size of any image, having to scale them down in memory.

+5  A: 

Engadget's reporting of the keynote included the following transcript from Steve Jobs

...It makes it so your apps run automatically on this, but it renders your text and controls in the higher resolution. Your apps look even better, but if you do a little bit of work, then they will look stunning. So we suggest that you do that

So I infer from that, if you use existing APIs your app will get scaled up. If you take advantage of new iOS4 APIs, you can get all groovy with the new pixels.

Paul Dixon
sounds good. So they seem to have some kind of highRes-switch in info.plist...
dontWatchMyProfile
+2  A: 

Yes it is true.

According to WWDC it appears that apple has build it some form of automatic conversion so that the resolution for applications will not be completely off. Think up-convert for dvd to HDTV's.

My guess would be that apple knows what most of the standards developers have been using and will already be using these for an immediate conversion. Of course if you are programming an application to take advantage of the new resolution it will look much nicer than whatever the result of apples auto-conversion is.

stocherilac
but keeping in mind that providing all graphics with 4 times the size (which is when you double hight and width), all old devices will suffer hard, loading giant files and scaling them down.
dontWatchMyProfile
perhaps, we do not know if apple will make distinctions between iphone 4 apps and legacy iphone apps the same way that they do between iphone and ipad apps. Its possible if something is designed explicitly for the iphone 4 that they will not be available for the previous versions.
stocherilac
that would make sense. The previous versions can't deal with that, and it would be stupid to hurt those weak, age old devices with high res graphics which they have to scale down.
dontWatchMyProfile
It is still a downer if you need to bundle your binary with all the extra graphics. 1 MB of png's would become 5 MB of png's.
RickiG
+6  A: 

This is purely speculation, but if the resolution really is 960 x 640 - that's exactly twice as high a resolution as the current version. It would be trivially simple for the iPhone to check the apps build target and detect a legacy version of the app and simply scale it by 2. You'd never notice the difference.

Paul Alexander
+1 for "You'd never notice the difference".
Emil
+4  A: 

It sounds like the display will be ok but I'm concerned about the logic in my game. Will touchesBegan positions return points in the new resolution? The screen bounds will be different, these types of things could potentially be problems for me.

sm2
No. That stuff is done with CoreGraphics (I think), which is resolution independent.
Alexsander Akers
Without risking ANY NDA issues, all iPhones have always returned points, not pixels. Since points are used in SDK 3.2 for iPad, I would not expect this to change for iPhone versions in the future.
Jann
+3  A: 

Scaling to a double resolution for display purpose is straight forward, but will this scalling apply to all api's that input/output a screen coordinate? If not things are going to break aren't they?

Fair enough if it's been handled extensively throughout the framework.. I would imagine there are a lot of potential api's this effects.

Mick N
I guess that the point where the calculations are done is so much low level, that any API is on top of that. So they could easily read a value from info.plist to see if the app is high resolution or not, and then handle any user interaction with the touchscreen or any drawing operation the appropriate way. Well, at least that's what I would have done when I was the chief of the iPhone SDK team ;-) ...According to Jobs that's not gonna break our apps. iPhone 4 buyers would hate it a lot if suddenly like 95% of all apps don't work on their new, super expensive device.
dontWatchMyProfile
That's good if the forward thinking was in the design. I wouldn't be surprised though if this was overlooked. I suppose I'm hoping to find some confirmation of whether this is true from someone with the sdk that can test it.
Mick N
I fear most of us, outside the US, will have to wait a long time until we're able to see it. Unless the new iPhone Simulator will be able to show up that new resultion.
dontWatchMyProfile
The iPhone simulator has 3 target devices: iPad, iPhone and iPhone 4. iPhone 4 shows the high resolution (i.e. I have to scroll to see the whole screen on my 15'' Macbook pro)
Thomas Müller
+10  A: 

Page 75 of the latest (2010-06-04) iPhone App Programming Guide.pdf:

https://developer.apple.com/iphone/prerelease/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/SupportingResolutionIndependence/SupportingResolutionIndependence.html

You will get access to this if you are a registered Apple Developer. Any discussion of iOS4 and it's features is prohibited except on Apple's own forums.

ohho
Mind you that UIKit views are drawn at the right scale no matter the resolution, de facto.Custom images being of concern, as addressed above. (Which is why you shouldn't use them to draw your interface when you can.)
JoePasq
@mystify, my understanding `@2x` is part of the name. Quote from the same pdf, "For example, if you have two image files, named `Button.png` and `[email protected]`, you would use the following code to request your button image:`UIImage* anImage = [UIImage imageNamed:@"Button"];`"
ohho
Is this post a possible NDA Violation?
Moshe
Sure *was*, Moshe.
Emil
By stating the post is in violation of the NDA you have confirmed it is valid, thereby breaking the NDA yourself.
Kendall Helmstetter Gelner
What about iOS3.0? What can you do there to display high-resolution images on iPhone 4? I sure want my apps to look great, but I also want people with 3.x to be able to use it...
Emil
+2  A: 

For people who are coming to this thread looking for a solution to a mobile web interface, check out this post on the Webkit blog: http://webkit.org/blog/55/high-dpi-web-sites/

It seems that Webkit has solved this problem four years ago.

+2  A: 

All of your labels and system buttons will be at 326dpi but your images will still be pixel doubled until you add the hi-res resources. I am currently updating my apps. If you build and run on the iPhone 4 sim then it is presented at 50%, go to Window > Scale > 100% to see the real difference! Labels are smooth, my images look shocking!

Picoman Games