title: IOS 7 - How to get the indexPath from button placed in UITableViewCell
body: <p>I've programmatically created a UITableView and added UISwitch to it's cell accessory view. </p>
  
  <p>This is my code for UISwitch in cell accessory view in <code>cellForRowAtIndexPath</code> method.</p>
  
  <pre><code>UISwitch *accessorySwitch = [[UISwitch alloc]initWithFrame:CGRectZero];
  [accessorySwitch setOn:NO animated:YES];
  [accessorySwitch addTarget:self action:@selector(changeSwitch:) forControlEvents:UIControlEventValueChanged];
  cell.accessoryView = accessorySwitch;
  </code></pre>
  
  <p>This is the method which is called after the button is clicked.</p>
  
  <pre><code>- (void)changeSwitch:(UISwitch *)sender{
  
      UITableViewCell *cell = (UITableViewCell *)[sender superview];
  
      NSIndexPath *indexPath = [self.filterTableView indexPathForCell:cell];
      NSLog(@"%ld",(long)indexPath);
  
   ……………. My other code…….
  }
  </code></pre>
  
  <p>I am able to print the index path value in iOS 6
  But in iOS 7 it prints nil,</p>
  
  <p>Am i missing anything in iOS 7 or there is some other approach to get the indexPath in iOS 7 </p>
  
  <p>Thanks,
  Arun.</p>