Basically I want to delete row on click event of a button which is a part of that row.
I can not use commit editing style because i want to perform unsubscribe and dele
You should get the indexPath of the button that was tapped. And then delete the selected index paths using standard API call. Like so:
- (IBAction) didTapSubscribeButton:(UIButton*)sender {
UIView* candidate = button;
while (![candidate isKindOfClass:[UITableViewCell class]]) {
candidate = candidate.superview;
}
NSIndexPath* indexPathToDelete = [self.tableView indexPathForCell:candidate];
[self.dataSourceArray removeObjectAtIndex:indexPath.row] //Considering that this is a single data source table view.
NSArray *indexPaths = [NSArray alloc]initWithObjects:@[indexPath],nil];
[self.tableView beginUpdates];
tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
}