0
我使用下面的代码来显示删除按钮时,用户滑动tableview
单元格。我想在这个按钮中写取消而不是删除,我怎样才能实现这个功能?Swipe to取代而不是删除UITableView
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
而且
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
//remove the deleted object from your data source.
//If you're data source is an NSMutableArray, do this
[self.dataArray removeObjectAtIndex:indexPath.row];
}
}
可能重复(http://stackoverflow.com/questions/1615469/custom-delete-button-on-editing-in-uitableview-cell) – dasblinkenlight 2013-03-01 15:24:47
它似乎你想保持功能,但显示一个不同的按钮。在这种情况下,滚动到最高票数的答案,看看你怎么能做到你想要的。 – dasblinkenlight 2013-03-01 15:25:37