tags:

views:

34

answers:

1

Hi all,

I am creating a custom UITableViewCell class in my iPhone app, but I am unclear how to state the dimensions given that the iPhone 2G/3G/3GS and iPhone 4 have different resolution screens.

Clearly, when I programmatically add an element, I'll use calculated coordinates based on the screen resolution, but when I am in interface builder, it draws the dimensions in for me at 3G coordinates (which is the type of device I have).

Does anyone know how to deal with this?

Many thanks, Brett

+2  A: 

You're confusing points and pixels. Everything in UIKit deals in points, which on all iPhones is 320x480. On an iPhone 4 1 point == 2 pixels as can be seen from the [[UIScreen mainScreen] scale]

Joshua Weinberg
You (the asker) don't ever need to worry about whether you're app is running on a device with a Retina display, or not, iOS will automatically handle everything for you, including using double-sized (`@2x`) resources. You don't ever have to do `if (retina display) { use twice as many pixels }`
Douwe Maan
I wouldn't say "ever", there are a few cases where you still need to, OpenGL being the big one.
Joshua Weinberg
OpenGL isn't part of UIKit, its part of QuartzCore, which is why I qualified it that way :) - edit:I see you were talking to Douwe, not me.
Joshua Weinberg