'NSInternalInconsistencyException', reason: 'UICollectionView received layout attributes for a ...
来源:互联网 发布:高洛峰php百度网盘 编辑:程序博客网 时间:2024/05/17 08:56
swift3.0自定义UICollectionViewLayout 当数据改变collectionView.reloadData()时出现如下错误:
'NSInternalInconsistencyException', reason: 'UICollectionView received layout attributes for a cell with an index path that does not exist: {length = 2, path = 10 - 0}'
经过不断调试,出现这种情况的原因是数据切换时数组长度变化,但是UICollectionViewLayout中定义的itemAttributes并没有清空。还是拿的reloadData()之前的数据
解决办法:在继承了UICollectionViewLayout的类中重写以下方法,将itemAttributes置为空
overridefunc invalidateLayout() {
super.invalidateLayout()
itemAttributes =nil
}
0 0
- 'NSInternalInconsistencyException', reason: 'UICollectionView received layout attributes for a ...
- UICollectionView recieved layout attributes for a cell with an index path that does not exist 解决办法
- iOS exception 'NSInternalInconsistencyException', reason: 'UICollectionView dataSource is not set'
- reason: 'UICollectionView must be initialized with a non-nil layout parameter'
- ***Terminatingappduetouncaughtexception'NSInternalInconsistencyException', reason: 'CouldnotloadNIBi
- Attributes Layout
- UICollectionView must be initialized with a non-nil layout parameter
- UICollectionView must be initialized with a non-nil layout parameter
- *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not
- "NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent sto
- *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could no
- Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFArra
- uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of ro
- * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '* -[NSCFArr
- Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableView
- *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid
- 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: !stayUp || CLClientIs
- Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewContr
- java的方法定义、数组定义、数组常用操作
- 指针运算的一点小结
- Hibernate基本映射(三)
- iOS开发之使用Storyboard预览UI在不同屏幕上的运行效果
- Mac命令行学习
- 'NSInternalInconsistencyException', reason: 'UICollectionView received layout attributes for a ...
- 13 Android Tools for Web Developers
- soa面向服务--案例(下)
- 当一个线程进入一个对象的一个synchronized方法后,其它线程是否可进入此对象的其它方法? ?
- Java面试前准备---数据库索引
- 查看各类系统端口占用情况
- DLL补丁劫持制作
- 深入理解ECMAScript中的声明提升、this关键字及作用域(链)
- iOS开发之遍历Model类的属性并完善使用Runtime给Model类赋值