title: Getting NSIndexPath of a row for UISwitch
body: <p>I have a tableview with custom UITableViewCells, each row in the table has a UILabel, UISwitch and detail disclosure indicator.</p>
  
  <p>I'm looking for the best method of capturing the UIControlEventChanged for the switch but I also need the NSIndexPath of the switch that changed to update Core Data.</p>
  
  <p>I don't want the UISwitch as an accessory type either.</p>
  
  <p>I've been googling this for hours and the solution that keeps popping up is to use </p>
  
  <pre><code>[switch addTarget:self action:@selector(switchTapped:) forControlEvents:UIControlEventChanged];
  </code></pre>
  
  <p>then in the switchTapped: method use the following to get the NSIndexPath</p>
  
  <pre><code>NSIndexPath *indexPath = [self.tableView indexPathForCell:(UITableViewCell *)[[sender superview] superview]];
  </code></pre>
  
  <p>Is there a better way of doing this? I already have UITableViewCell subclassed, can I put a method in this class to return the NSIndexPath for a given switch?</p>
  
  <p>Thanks in advance for any help</p>