tableviewcell 侧滑删除 点击返回按钮 程序崩溃 [ tableView:canEditRowAtIndexPath:]:message sent to deallocated insta

来源:互联网 发布:今天耐克淘宝抢购 编辑:程序博客网 时间:2024/06/05 17:22

IOS6中 tableViewCell侧滑,处于编辑状态 点击返回上个页面 没有任何问题

但是在IOS7以后的系统中 这样操作会出现message sent to deallocated instance 0x12e23ac50错误


原因是下面这个方法的使用导致的

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


解决办法

1,

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

如果此方法没有用到,删掉就可以了

2,如果一定要用到此方法,在

- (void)viewWillDisappear:(BOOL)animated方法中添加

_tableView.editing = NO;这句代码就可以解决了


0 0
原创粉丝点击