views:

844

answers:

3

Hi all,

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.

+2  A: 

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).

Joel Martinez
You can use the UIView.autoResizingMask and various other knobs, and you can get screen resolution. These are all available, and *I* am accounting for it, but I wonder if other developers are (such as you?)
groundhog
I guess that's what I was trying to say. Although you may be enlightened enough to know the techniques ... if the majority of sample code available to developers does not take resolution into account, then (IMO) most developers will not
Joel Martinez
+2  A: 

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.

MikeJ
+3  A: 

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."

Gordon Potter