5
votes

Something I've been concerned about for a while as I'm developing my applications is the oft hard coded geometry of images and view components that take for granted the 320x480 nature of the current display generations.

I've seen many answers in StackOverflow and in examples / tutorials that hard code in the screen dimensions. I've made some textures for backgrounds that are 320x480 in size as well, but am careful to make them UIViewContentModeScaleToFill, but I am not entirely positive that pixel positioning in the IB will result in hardware specific interfaces.

At some point I imagine (and hope!) that the iPhone will have different display resolutions.

  • Are you as developers planning for this?

  • What are you doing to account for variable screen resolutions in the future?

(Assuming of course that someone would want more than 640kb, oh sorry, 320x480 resolution :))

Please see this URL: http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/SupportingResolutionIndependence/SupportingResolutionIndependence.html#//apple_ref/doc/uid/TP40007072-CH10

For iOS4 answer from Apple.

3

3 Answers

3
votes

You might want to check out NSScreen for OS X and UIScreen for iPhone.

From the documentation:

"...you should use the properties of this object to get the recommended frame rectangles for your application’s window."

2
votes

You should be. If there is a way to retrieve those metrics from the API, you should. Back in the old days of the mac, lots of poeple hard coded for the the 9" screen. When I got my mac XL (essentially a lisa case with a mac main board inside) it has a 12" screen and the number of "broken" apps that didn't scale was legend.

Short of it is that if there is going to be some radical change in the hardware, Apple will surely do it. Any company that can successfully change chip platforms TWICE has no fear in updating hardware, software and whatever else to make things better.

2
votes

I think that you inadvertently answered your own question (are you planning for this) in your description of the issue. If much of the sample code you see does not account for it, then many developers (who copy/paste from sample code) are not accounting for it.

I would imagine that if apple is going to allow for other resolutions, that they'd have a way of running in compatibility mode for older apps, or a way to check for desired resolution (with the default being the existing resolution so older apps don't have to change).