views:

519

answers:

1

I converted my old UITableViewCell from being programmatically created to using Interface Builder and a Xib. When implemented in code and in edit mode, I moved some of the labels in the cell to make room for the delete button. How do I change the layout of the cell in edit mode when implemented as a Xib? Preferably animated. Links or tutorials are certainly welcome!

If it matters, this is for a 3.0 SDK app.

+1  A: 

You need to get a reference to the subviews you would like to move. Two ways to do this are:

  1. Tag the views in IB

  2. Use IBOutlets

If you tag the subview you would like to move, you can find it by:

[cell.contentView viewWithTag:kMyTag];

If you choose to use IBOutlets, you should consider creating Cell Controllers for each cell.

A good tutorial on this can be found here:

http://bill.dudney.net/roller/objc/entry/uitableview_from_a_nib_file

Also consider moving your cell logic into the cell controllers and out of the table view controller as mentioned in this tutorial:

http://cocoawithlove.com/2008/12/heterogeneous-cells-in.html

Corey Floyd