Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

firewood

macrumors G3
Original poster
Jul 29, 2003
8,144
1,389
Silicon Valley
So what would be the best coding practices to make sure that an iPhone app is resolution independent.

No use of hardcoded 320 or 480 as dimensions? (Instead read the actual window frame rect in use, just in case.)
Use all floating point coordinates so that the dimensions scale more smoothly?
Make sure all views handle rotation and phone call status bar resizing?
Use fractions of a view's width and height instead of hardcoded pixel positions (e.g. position a center buttons center at viewwidth/2.0 instead of at 160.0)?
Use higher resolution png's or maybe jpg's that need to be shrunk down for display on 320x480 view, so they won't look to pixelly when displayed at a larger size? (Even if this makes a app much larger?)
Higher resolution textures for OpenGL?
No hardcoded line breaks, because text lines might be much wider?

Others?

Should button sizes be fixed, or automatically get larger?
 
There aren't really any best practices. Proportions vary based on the application in question. Some things automatically resize to occupy all the area they can (UITableViews, I think, do this).

Positioning elements as fractions can help when it comes to rotating, but they won't help much when it comes to higher resolution screens. Fonts are going to get screwed up (as their sizes are not given as fractions), images won't scale well, and many elements, if proportionally scaled, will just take too much screen space for their relatively minor function.

There isn't much you can do right now.
 
I imagine that were Apple to release a device with significantly more screen retail, it would similarly have more CPU and battery and so be capable of running more than one application at a time.

As a result, I'd think many applications would become windowed (with the exception of things like fullscreen games... maybe art programs where being full screen is useful too.)

Of course, I'd say it's all useless until Apple reveals anything.

Just use fractions of the screen size as opposed to assuming 160 or whatever is the center.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.