title: How to get a UITableViewCell from one of its subviews
body: <p>I have a <code>UITableView</code> with a <code>UITextField</code> in each of the <code>UITableViewCells</code>. I have a method in my ViewController which handles the "Did End On Exit" event for the text field of each cell and what I want to be able to do is update my model data with the new text.</p>
  
  <p>What I currently have is:</p>
  
  <pre><code>- (IBAction)itemFinishedEditing:(id)sender {
      [sender resignFirstResponder];
  
      UITextField *field = sender;
      UITableViewCell *cell = (UITableViewCell *) field.superview.superview.superview;
  
      NSIndexPath *indexPath = [_tableView indexPathForCell:cell];
  
      _list.items[indexPath.row] = field.text;
  }
  </code></pre>
  
  <p>Of course doing <code>field.superview.superview.superview</code> works but it just seems so hacky. Is there a more elegant way? If I set the tag of the <code>UITextField</code> to the <code>indexPath.row</code> of the cell its in in <code>cellForRowAtIndexPath</code> will that tag always be correct even after inserting and deleting rows? </p>
  
  <p>For those paying close attention you might think that I have one <code>.superview</code> too many in there, and for iOS6, you'd be right. However, in iOS7 there's an extra view (NDA prevents me form elaborating) in the hierarchy between the cell's content view and the cell itself. This precisely illustrates why doing the superview thing is a bit hacky, as it depends on knowing how <code>UITableViewCell</code> is implemented, and can break with updates to the OS.</p>