The number of sections contained in the collection view after the update (1) must be equal to the number of sections contained in the collection view before the update (0), plus or minus the number of
现象:当删除CollectionView 当中的某个section的时候,报上面的错误
初步分析:当前CollectionView删除前后都不止一个Section,怎么会报那样的错误;猜想可能是相册界面的另外两个UICollectionView,对当前的CollectionView有影响。
初步验证:当加载了另外一个collectionView,再去删除原collectionView时并没有报错
解决方案:ViewDidLoad的时候加载三个CollectionView
再次分析:按道理应该是不会相互影响的,百度了一下之后发现通常出现这类问题是由于执行了增删操作之后,数据源返回的section数据和collectionView中的不一致, 检查代码numberOfSectionsInCollectionView 中 发现多了一个if(HasLoaded){ // do something; } else { return 0; } 的判断;
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
if (HasLoaded) {
NSInteger type =;
for (NSInteger k=; k<; k++) {
if (collectionView == self.collectionViewArray[k]) {
type = k;
break;
}
}
NSInteger count = self.httpConnect.WifiConnected? self.dataModel.ListsArray[type].SectionArray.count: self.dataModel.LocalListsArray[type].SectionArray.count;
if (count== && ![self.collectionViewArray[type] isHidden]) {
self.noDataImageView.hidden = NO;
self.noDataLabel.hidden = NO;
}else {
self.noDataImageView.hidden = YES;
self.noDataLabel.hidden = YES;
}
return count;
}
else {
return ;
}
}
当我加载了其他两个CollectionView之后,使HasLoaded为true了,所以之前的分析只是凑巧解决了那个问题。
正确方案:去掉HasLoaded,即可
The number of sections contained in the collection view after the update (1) must be equal to the number of sections contained in the collection view before the update (0), plus or minus the number of的更多相关文章
- ZOJ Problem Set - 3329(概率DP)
One Person Game Time Limit: 1 Second Memory Limit: 32768 KB Special Judge There is a very ...
- HDU5909 Tree Cutting(树形DP + FWT)
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5909 Description Byteasar has a tree T with n ve ...
- Echars详解
简介 ECharts,缩写来自Enterprise Charts,商业级数据图表,一个纯Javascript的图表库,可以流畅的运行在PC和移动设备上,兼容当前绝大部分浏览器(IE6/7/8/9 /1 ...
- 留念 C语言第一课简单的计算器制作
留念 C语言第一课简单的计算器制作 学C语言这么久了. /* 留念 C语言第一课简单的计算器制作 */ #include<stdio.h> #include<stdlib.h ...
- CodeForces 558A
Description Amr lives in Lala Land. Lala Land is a very beautiful country that is located on a coord ...
- Codeforces Round #312 (Div. 2) A. Lala Land and Apple Trees 暴力
A. Lala Land and Apple Trees Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/cont ...
- 【HDU 5909】 Tree Cutting (树形依赖型DP+点分治)
Tree Cutting Problem Description Byteasar has a tree T with n vertices conveniently labeled with 1,2 ...
- zoj3329 One Person Game
One Person Game Time Limit: 1 Second Memory Limit: 32768 KB Special Judge There is a very simple and ...
- ZOJ3329之经典概率DP
One Person Game Time Limit: 1 Second Memory Limit: 32768 KB Special Judge There is a very ...
随机推荐
- 【MFC】CHtmlView或WebBrowser禁止脚本错误提示
错误展示: 解决办法: 1.CHtmlView类或子类 CHtmlView::SetSilent(TRUE); 2.IWebBrowser2控件 IWebBrowser2::put_Silent(TR ...
- Java设计模式—组合模式
组合模式是一种常见的设计模式(但我感觉有点复杂)也叫合成模式,有时又叫做部分-整体模式,主要是用来描述部分与整体的关系. 个人理解:组合模式就是将部分组装成整体. 定义如下: 将对象组合成树形结构以表 ...
- Maximum Product Subarray 最大连续乘积子集
Find the contiguous subarray within an array (containing at least one number) which has the largest ...
- 安装 Python IDLE (Linux)
Python IDLE (Integrated Development and Learning Environment) 是一个官方的轻量级 Python IDE.在不同的 Linux 的发布版本中 ...
- spring cloud Eureka server配置
参考:http://www.ityouknow.com/springcloud/2017/05/10/springcloud-eureka.html spring boot版本:2.0.3.RELEA ...
- Mybatis源码解析优秀博文
最近阅读了许久的mybatis源码,小有所悟.同时也发现网上有许多优秀的mybatis源码讲解博文.本人打算把自己阅读过的.觉得不错的一些博文列出来.以此进一步加深对mybatis框架的理解.其实还有 ...
- aspnetcore 认证相关类简要说明三
今天我们再来了解一个很重要的接口IAuthenticationService的实现类AuthenticationService: public class AuthenticationService ...
- Sharepoint配置Projectserver
1 需要创建一个project server application 程序. 2 创建一个内容数据库,这个比较简单,微软文档中如下表述: 3 创建一个Project Web App 需要用命 ...
- 十分钟带你学会Http协议和Tomcat服务器的原理
1. Http协议 1. 什么是Http协议 HTTP,超文本传输协议(HyperText Transfer Protocol)是互联网上应用最为广泛的一种网络协议.所有的WWW文件都必须遵守这个标准 ...
- CentOS7使用systemctl添加自定义服务
一.简介 Centos7开机第一个程序从init完全换成了systemd这种启动方式,同centos 5 6已经是实质差别.systemd是靠管理unit的方式来控制开机服务,开机级别等功能. 在/u ...