Iphone UITableView“;轻扫以删除";函数冻结
我不明白为什么点击删除按钮后我的tableView没有更新 单击它后,表视图“冻结”。如果我单击另一行,使tableview转到层次结构的另一个级别并单击“上一步”,我可以看到该项已被删除,并且一切正常 这是我的密码:Iphone UITableView“;轻扫以删除";函数冻结,iphone,objective-c,uitableview,Iphone,Objective C,Uitableview,我不明白为什么点击删除按钮后我的tableView没有更新 单击它后,表视图“冻结”。如果我单击另一行,使tableview转到层次结构的另一个级别并单击“上一步”,我可以看到该项已被删除,并且一切正常 这是我的密码: - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)ind
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
//[tableView beginUpdates];
if (editingStyle == UITableViewCellEditingStyleDelete)
{
// Do whatever data deletion you need to do...
[tableView beginUpdates];
NSManagedObject *obj = (NSManagedObject *)[entityArray objectAtIndex:indexPath.row];
[managedObjectContext deleteObject:obj];
NSError *error;
[managedObjectContext save:&error];
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:YES];
[self viewWillAppear:YES];
}
//[tableView endUpdates];
}
如对此问题有任何意见,将不胜感激
谢谢。我看不到对
[tableView EndUpdate]
的调用与[tableView BeginUpdate]
匹配,该调用位于if
的开头
是否正是由于这个原因,您的表冻结了?我看不到对
[tableView EndUpdate]
的调用与[tableView BeginUpdate]
匹配,该调用位于if
的开头
是否正是因为这个原因,您的表冻结了?发现了相同的问题,并偶然发现了此线程。但tableview冻结问题的原因与我们的情况不同 为了子孙后代: 进入编辑模式以显示“插入”或“删除”按钮的UITableViewCell不应将其
userInteractionEnabled
属性设置为“否”
通过更正此问题,我们解决了相同的tableview冻结问题。发现了相同的问题,并偶然发现了此线程。但tableview冻结问题的原因与我们的情况不同 为了子孙后代: 进入编辑模式以显示“插入”或“删除”按钮的UITableViewCell不应将其
userInteractionEnabled
属性设置为“否”
通过纠正这一点,我们解决了同样的tableview冻结问题。您为什么要将
/[tableview EndUpdate]代码>在if之外,并对其进行了注释?您绝对不应该调用[self-ViewWillExample:YES];为什么要将/[tableView endUpdates]代码>在if之外,并对其进行了注释?您绝对不应该调用[self-ViewWillExample:YES];啊,我应该抓住那个。谢谢你啊,我应该抓住那个。非常感谢。