views:

714

answers:

1

I have a simple application that uses a few non-standard UITableViewCellStyles (like UITableViewCellStyleValue1, UITableViewCellStyleValue2 or UITableViewCellStyleSubtitle).

When I run the app in the Simulator all works just fine; but when I run the app on the Device, the UILabel's don't necessarily vertically line up in the middle of the cell. I've done some additional debugging and determined that when I use UITableViewCellStyleValue1 or UITableViewCellStyleValue2 - it seems that if I assign text to just "cell.textLabel.text", that label will appear 'higher' than the middle of the cell.

If I also assign text to "cell.detailTextLabel.text", then both of the labels are vertically centered. Furthermore, if I only assign text to "cell.detailTextLabel.text", then again, it is not vertically centered.

I am running Xcode 3.1.4 and deploying iPhoneOS 3.1.2 SDK to an first generation iTouch 32GB unit and not sure what is happening.

+1  A: 

It seems like a bug to me, but a workaround is to set cell.detailTextLabel.text = @""; if you don't want any text to appear on the right side of the cell. Why it expects a string in both is bizarre but the above line worked around it for me.

Ben
This fix works for me too.
bobo