Delete a UITableView row by click on custom UIButton

后端 未结 7 1040
梦谈多话
梦谈多话 2020-12-22 04:16

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

7条回答
  •  离开以前
    2020-12-22 04:31

    It works with following code

    On button click event

        CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.table];
        NSIndexPath *indexPath = [self.table indexPathForRowAtPoint:buttonPosition];
        [self.arraylist removeObjectAtIndex:indexPath.row];
        [self.table deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    

提交回复
热议问题