Loading a Reusable UITableViewCell from a Nib

Greg Martin picture Greg Martin · Jan 5, 2009 · Viewed 89.5k times · Source

I am able to design custom UITableViewCells and load them just fine using the technique described in the thread found at http://forums.macrumors.com/showthread.php?t=545061. However, using that method no longer allows you to init the cell with a reuseIdentifier which means you have to create whole new instances of each cell at every call. Has anyone figured out a good way to still cache particular cell types for reuses, but still be able to design them in Interface Builder?

Answer

Tim Keating picture Tim Keating · Apr 19, 2009

Actually, since you are building the cell in Interface Builder, just set the reuse identifier there:

IB_reuse_identifier

Or if you are running Xcode 4, check the Attributes inspector tab:

enter image description here

(Edit: After your XIB is generated by XCode, it contains an empty UIView, but we need a UITableViewCell; so you have to manually remove the UIView and insert a Table View Cell. Of course, IB will not show any UITableViewCell parameters for a UIView.)