tableView:canEditRowAtIndexPath:弹出viewController时崩溃 [英] tableView:canEditRowAtIndexPath: crash when popping viewController
问题描述
我有一个带有 UITableView
的viewController,我可以通过滑动编辑(删除)这些行 - 就像在Mail应用程序中一样。我这样做是为了这个方法:
I have a viewController with a UITableView
, the rows of which I allow to edit (delete) with a swipe - much like in the Mail app. I do it with, among other, this method:
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
但是,如果我显示删除按钮,同时我使用我的 UINavigationController
的后退导航,即当我 popViewControllerAnimated:
时,应用程序崩溃并显示以下消息:
However, if I have a delete button revealed, and at the same time I use back navigation of my UINavigationController
, i.e. when I popViewControllerAnimated:
, the app crashes with the following message:
[ViewController tableView:canEditRowAtIndexPath:]:发送到解除分配的实例0xaae64d0的消息
怎么能我解决了这个问题?
How can I resolve this problem?
推荐答案
在视图控制器的 dealloc
方法中,将表格视图的编辑
属性设置为否
。
In your view controller's dealloc
method, set the table view's editing
property to NO
.
这篇关于tableView:canEditRowAtIndexPath:弹出viewController时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!