来自 iOS7 的 UICollectionViewLayoutAttributes 中的 UICollectionView 异常 [英] UICollectionView exception in UICollectionViewLayoutAttributes from iOS7

查看:23
本文介绍了来自 iOS7 的 UICollectionViewLayoutAttributes 中的 UICollectionView 异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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;不会使布局无效'

'layout attributes for supplementary item at index path ( {length = 2, path = 0 - 0}) changed from CustomSupplementaryAttributes: 0xd1123a0 index path: (NSIndexPath: 0xd112580 {length = 2, path = 0 - 0}); element kind: (identifier); frame = (0 0; 1135.66 45); zIndex = -1; to CustomSupplementaryAttributes: 0xd583c80 index path: (NSIndexPath: 0xd583c70 {length = 2, path = 0 - 0}); element kind: (identifier); frame = (0 0; 1135.66 45); zIndex = -1; without invalidating the layout'

推荐答案

更新前需要使现有布局失效,错误信息见末尾:

You need to invalidate the existing layout before updating, see the end of the error message:

不会使布局无效'

[collectionViewLayout invalidateLayout];

苹果 UICollectionViewLayout 文档

这篇关于来自 iOS7 的 UICollectionViewLayoutAttributes 中的 UICollectionView 异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆