开发者

UITableView, Catching touches on delete?

I wonder if someone would be so kind as to help me out with a query I have regarding deleting rows from a UITableView. I have implemented tableView:commitEditingStyle:forRowAtIndexPath: and now get the [DELETE] button appearing when I swipe on a cell, my question is which method do I need to use to catch a user pressin开发者_开发技巧g that button (i.e. [DELETE]).

Also when I do delete a row, can I delete the row from my dataSource and refresh the table. OR should I delete the row from the dataSource and then call some other method on the tableView?


This is what I was after, the callback for the swipe and the callback when the user selects [DELETE].

- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"Swipe ...");
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"Delete Pressed.");
}


Delete from the data source and call reloadData on the table. Or do you have like a million rows in the table?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜