我试着把它放在代码的各个部分,比如在commitEditingStyle方法的末尾,但是我不能让它停止编辑模式。基本上,我希望在没有更多单元格时自动退出编辑模式...
if ([self.tableView numberOfRowsInSection:0] ==0)
{
NSLog(@"this triggers, but doesn't stop editing..");
self.tableView.editing = NO;
[self.tableView endEditing:YES];
}
发布于 2010-11-24 21:22:32
那[self setEditing:NO animated:YES]
呢?我认为to self是UITableViewController的一个实例。
发布于 2013-03-07 03:16:44
来自苹果文档:
Note: The data source should not call setEditing:animated: from within its implementation of tableView:commitEditingStyle:forRowAtIndexPath:. If for some reason it must, it should invoke it after a delay by using the performSelector:withObject:afterDelay: method.
因此,在commitEditingStyle
中调用它并不是一个很好的做法。
发布于 2010-11-24 21:24:07
如果不只是[self setEditing:NO animated:YES]
?
https://stackoverflow.com/questions/4266997
复制相似问题