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 ...
随机推荐
- 【javascript】javasrcipt设计模式之状态模式
使用场景 解决多个[ifelse]嵌套,将其封装成若干个方法 区分事物内部的状态,事物内部的状态的改变往往会带来事物的行为的改变 简单的多个状态直接切换的时候 //两个状态之间的切换,使用if-els ...
- How to save rules of the iptables?
The easy way is to use iptables-persistent. Install iptables-persistent: sudo apt-get install iptabl ...
- 当EditText编辑时 hint 在 6.0 手机上显示不出来
当EditText编辑时 hint 在 6.0 手机上显示不出来.... 就要增加一句话去重新设置颜色值 Android:textColorHint = "#707070"
- linux下close 掉socket 之后 阻塞的recv 不会立即返回
转载自:http://www.cnblogs.com/wainiwann/p/3942203.html 在开发的一个基于rtmp聊天的程序时发现了一个很奇怪的现象. 在windows下当我们执行 cl ...
- vmware虚拟机安装CentOS教程
linux是企业最常用的服务器系统之一,CentOS是免费的,所以用的企业也挺多,今天给大家分享怎么在自己电脑的虚拟机中安装CentOS-6.5,以便用来玩耍,没事的时候可以学学linux的一些知识. ...
- java 简单工厂 工厂模式
<Head First 设计模式>学习中 分类 简单工厂模式(Simple Factory) 工厂方法模式(Factory Method) 抽象工厂模式(Abstract Factory) ...
- 分享:linux系统如何快速阻止恶意IP地址
可能你想要在各种情形下阻止有人通过IP地址访问你的Linux系统.比如说,作为最终用户,你可能想要保护自己,避免已知的间谍软件或跟踪者的IP地址.或者如果你在运行P2P软件,可能想要把来自与违反P2P ...
- js构建类的方法
Javascript是一种基于对象的语言,你遇到的所有东西几乎都是对象.但是,它又不是一种真正的面向对象编程(OOP)语言,因为它的语法中没有Class.(不过,ES6引入了Class这个概念,作为对 ...
- [翻译] SVProgressHUD
SVProgressHUD https://github.com/TransitApp/SVProgressHUD SVProgressHUD is a clean and easy-to-use H ...
- Web前端——jQuery----细节
jQuery终极思想:创建jQuery对象(当发现相同的选择器在你的代码里出现多次时,请用变量把它储存起来.一切面向对象) 认识jQuery 1.jQuery库可以做什么? HTML元素选取 HTML ...