我有一个的ViewController有一个UITableView,其中我允许编辑(删除)或者滑动出现删除按钮。我这样做,除其他,这个方法:
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { return YES; }不过,如果删除按钮显示出来后,点击导航UINavigationController的返回按钮,即当我popViewControllerAnimated:应用程序崩溃,并显示以下消息:
[ViewController tableView:canEditRowAtIndexPath:]: message sent to deallocated instance 0xaae64d0
解决方案:
1、viewcontroller‘s dealloc
method,
set the table view‘s editing
property
to NO
.
2、viewcontroller‘s viewWillDisappear
, set the table view‘s editing
property
to NO
.
- (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [table setEditing:NO]; }
tableView:canEditRowAtIndexPath: crash when popping viewController,布布扣,bubuko.com
tableView:canEditRowAtIndexPath: crash when popping viewController
原文:http://blog.csdn.net/lin1986lin/article/details/23938993