Archive for May 2nd, 2010

02
May

UITableViewCell from nib warning

If you’ve been reading for a while you might recall this post about loading your UITableViewCell layout from a nib. Or perhaps you stumbled across that somewhere else, or even came up with it on your own; well, if you have been doing that, turns out there’s an additional wrinkle you need to be aware of:

… The key here is that the CellIdentifier value must also be entered into Interface Builder, like this:

UITableViewCell-Identifier.png

If you don’t do this, then UITableViewCells will not be reused. (A telltale sign of this is that you’ll see lots of “creating a new cell” log messages.) There is no compiler or runtime warning if you fail to enter this critical piece of information into Interface Builder. So that log statement can be a useful warning…

Yes. Yes, indeed, if you have several thousand items in your list, and you’re loading directly from the nib each time, that could be very very bad. Be careful out there!