Search code examples
iphoneiphone-4

UITableViewCell in iPhone 4 and iPhone 3G/GS


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


Solution

  • 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]