I got this strange issue while working with iPhone SDK 3.1.2.
My UITableViewCell contains 3 UILabel, each of which is assigned a numeric tag from 1 to 3.
http://img.skitch.com/20100109-gdg9f57999gne3psqmmb3y4nb1.png
The problem is with the first UILabel (highlighted in the above screenshot): I am unable to set its text to anything. Even NSLog its content gives me a (null).
What’s interesting is that when I tried to print the UILabel’s class name, I got UITableViewCell instead.
http://img.skitch.com/20100110-7jfgipbiskbc9xm68pt3mqfqi.png
Changing this particular UILabel’s tag to other number (e.g. 4) makes it work properly. How strange.
Anyone got an idea?
Since you’re creating the cell in Interface Builder, I wouldn’t use the tag thing anyway. I’d just subclass UITableViewCell as MyCell or something, change your table cell’s class to MyCell, then declare some IBOutlets in MyCell that you can connect the subviews to. That also allows you to define some convenience methods/properties for the cell as well.
Then you can forget the tags and just do myCellInstance.nameLabel.text = @”Joebob Briggs” or whatever.