I've used the sample code from Apple for "Accessory" to have a custom accessory image in my table. The table renders the image properly and everything but when I click on the image that is supposed to take me to the accessoryButtonTappedForRowWithIndexPath method nothing happens because indexPath is nil for some reason. See this method which checks the indexPath:
- (void)accessoryButtonTapped:(id)sender event:(id)event
{
NSSet *touches = [event allTouches];
UITouch *touch = [touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint: currentTouchPosition];
if (indexPath != nil)
{
[self tableView: self.tableView accessoryButtonTappedForRowWithIndexPath: indexPath];
}
}
Why can't you just use tableView:accessoryButtonTappedForRowWithIndexPath:
in your UITableViewDelegate
?