我試過了,但刷卡不觸發tableView:willBeginEditingRowAtIndexPath:根本!和刪除按鈕從不出現,有沒有解決方法?我可以在自定義的uitableviewcell中使用滑動刪除功能嗎?
編輯:這是我實現
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView beginUpdates];
if (editingStyle == UITableViewCellEditingStyleDelete)
{
if(_itemsArray == nil)
NSLog(@"\n\nNIL ARRAY\n\n");
NSLog(@"\nindexPath.row = %d\nItemsArray Count:%d",indexPath.row,_itemsArray.count);
int row = [[[_itemsArray objectAtIndex:indexPath.row]valueForKey:@"itemRow"] integerValue];
[_itemsArray removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[[self delegate]didDeletedBillItemRow:row];
}
[tableView endUpdates];
}
在定製的tableview細胞禁用用戶交互 – NANNAV 2013-02-13 07:31:17
使tableview.setEditing = YES; – Vinodh 2013-02-13 08:44:32