title: UITableView with custom cell subview - respondsToSelector:]: message sent to deallocated instance
body: <p>I have a ViewController that contains a UITableView in which the cells are created via a custom subview (so that each cell will have a label and textfield).  The subview includes TextField delegate methods that get fired on textFieldDidBeginEditing, textFieldDidEndEditing, etc.  The UITableView caches the cells that are visible and destroys them when a cell is no longer visible.  The problem I have is when the user taps on a TextField in a cell and then scrolls the table so that the cell being "edited" is out of view and then taps on a new cell to edit it, the original cell's textFieldDidEndEditing delegate method is called, causing a "respondsToSelector:]: message sent to deallocated instance" error because the original/first TextField has been destroyed by the UITableView when it was scrolled out of the visible area.</p>
  
  <p>Has anyone dealt with this issue before and found a solution so that I can keep my textFieldDidEndEditing methods for proper handing of the data the user's input without having the now-invisible cells destroyed?</p>
  
  <p>EDIT: I just found this in the UITableView Class Reference doc: "Avoid relayout of content. When reusing cells with custom subviews, refrain from laying out those subviews each time the table view requests a cell. Lay out the subviews once, when the cell is created."</p>
  
  <p>This is, I think, the root of my issue.  But I am not sure how to follow this advice.  Help...</p>