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