首页 > 其他 > 详细

tableView:canEditRowAtIndexPath: crash when popping viewController

时间:2014-04-18 08:49:19      阅读:543      评论:0      收藏:0      [点我收藏+]

 bubuko.com,布布扣

我有一个的ViewController有一个UITableView,其中我允许编辑(删除)或者滑动出现删除按钮。我这样做,除其他,这个方法:

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {

    return YES;
}
不过,如果删除按钮显示出来后,点击导航UINavigationController的返回按钮,即当我popViewControllerAnimated:应用程序崩溃,并显示以下消息:

[ViewController tableView:canEditRowAtIndexPath:]: message sent to deallocated instance 0xaae64d0

(我的开发环境:xcode5.1)此种情况在IOS7以下版本不会出现,只会出现在IOS7上,觉得很奇怪;


解决方案:

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!