Changing the accessory view icon

Changing the stupid accessory icon is small exercise if you know precisely the right steps.

Create the icon and change the accessory view to the icon view
UIButton* pencil = [UIButton buttonWithType:UIButtonTypeCustom];
[pencil setImage:[UIImage imageNamed:@"icon-pencil.gif"] forState:UIControlStateNormal];
pencil.frame = CGRectMake(0, 0, 15, 15);
pencil.userInteractionEnabled = YES;
[pencil addTarget:self action:@selector(didTapEditButton:) forControlEvents:UIControlEventTouchDown];
cell.accessoryView = pencil;
Code from:

as a custom controller has been called it need to know the IndexPath. For that use:
- (void)checkButtonTapped:(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];
code from:
the code calls the delegate with the indexPath