佚名通过本文主要向大家介绍了tableview,qt tableview,tableview详解,qt tableview详解,ios tableview等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: tableview侧滑删除的时候,删除最后一行的时候报错。
描述:
解决方案1:
描述:
删除的代理方法中实现如下:- (void)tableView:(UITableView )tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath )indexPath{
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSIndexPath * path = [_businessTableview indexPathForCell:_memoryCell];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//[self DelegateRecode:[NSString stringWithFormat:@"%@",IDArr[indexPath.row]]];
dispatch_async(dispatch_get_main_queue(), ^{
[resultArr removeObjectAtIndex:path.row];
[_businessTableview beginUpdates];
[_businessTableview deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
_memoryCell = nil;
[_businessTableview endUpdates];
if(resultArr.count == 0){
[_businessTableview deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationLeft];
}
});
});
}
}
报错如下:
2016-09-08 16:03:25.803 SUOTAO[5986:2554341] * Assertion failure in -[UITableView _endCellAnimationsWithContext:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.60.12/UITableView.m:1716
其中:数据源是我从后台得到的数组,section 返回的是1,写的死数据。
解决方案1:
应该是直接删section吧,你的代码似乎会在删row的时候就报错。
您可能想查找下面的文章:
- 代码持续更新tableview与用户滑动tableview冲突?
- UITableViewCell加载多张图片导致内存异常暴增
- 求“ios7tableviewcell上面button的点击效果没有”的swift版解决办法
- 很多股票APP,VIP推送功能频繁更新tableview,是如何保证APP流畅度的
- iOS基础控件IOS的UITableView问题
- UITableViewCell中嵌套UICollectionView,希望前者的高度根据后者的高度而改变
- UITableView显示富文Html列表,有什么实现方案
- (swift)UITableViewCell放置Button,怎么让Cell的高度随着Button的文字长度自动增加
- iOSUITableViewCell按钮点击状态为什么刷新以后会变回到为未点击状态
- 如何获取UITableView编辑模式下的系统自带手势?