Q: how to call didDeselectRowAtIndexPath from UIButton cell item iOS I have a custom cell having a UIButton and a UITextField. Now when i click on the button i want to capture the indexpath.row in didDeselectRowAtIndexPath. but when i click on the button didDeselectRowAtIndexPath is not called. I know button will capture the click. but curious to know any workaround? any smart way guys.
Please guide
thanks.


A: Add button's target in     
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

     //Continue with your code...

 [cell.actionButton addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside];    
}


- (void)didTapButton:(id)sender {
    // Cast Sender to UIButton
    UIButton *button = (UIButton *)sender;

    // Find Point in Superview
    CGPoint pointInSuperview = [button.superview convertPoint:button.center toView:self.tableView];

    // Infer Index Path
    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:pointInSuperview];

    NSLog(@"%d", indexPath.row);
}


A: there is no need to calling didSelect Method from button click event try in to your - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath index just setting button tag is indexPath.row like:
     cell.btnInvite.tag=indexPath.row;
     [cell.btnInvite addTarget:self action:@selector(btnCommentClick:) forControlEvents:UIControlEventTouchUpInside];


-(void)btnCommentClick:(UIButton*)sender
{
  NSLog(@"frined add %d",sender.tag); //now do you stuff that you want you have selected cell index as a button tag.

}

