问题描述
我在 CollectionView 中用 CustomLayout 做了一个视图.在 iOS6 中它运行良好,但在 iOS7 中它会抛出这样的异常.
I have done a View in CollectionView with CustomLayout. In iOS6 it worked great but iOS7 it throws an exception like this.
由于未捕获的异常NSInternalInconsistencyException"而终止应用,原因:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:
'索引路径({length = 2,path = 0 - 0})处的补充项的布局属性从CustomSupplementaryAttributes更改:0xd1123a0索引路径:(NSIndexPath:0xd112580 {length = 2,path = 0 - 0});元素种类:(标识符);框架 = (0 0; 1135.66 45);zIndex = -1;到 CustomSupplementaryAttributes: 0xd583c80 索引路径: (NSIndexPath: 0xd583c70 {length = 2, path = 0 - 0});元素种类:(标识符);框架 = (0 0; 1135.66 45);zIndex = -1;不会使布局无效'
推荐答案
更新前需要使现有布局失效,错误信息见末尾:
You need to invalidate the existing layout before updating, see the end of the error message:
不会使布局无效'
[collectionViewLayout invalidateLayout];
这篇关于来自 iOS7 的 UICollectionViewLayoutAttributes 中的 UICollectionView 异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!