Tag: uicollectionviewlayout

iOS 10的bug:UICollectionView收到一个索引path不存在的单元格的布局属性

在iOS 10的设备上运行我的应用程序我得到这个错误: UICollectionView收到一个索引path不存在的单元格的布局属性 在iOS 8和9工作正常。 我一直在研究,我发现这是相关的无效的集合视图布局。 我试图实现这个解决scheme没有成功,所以我想要求直接的帮助。 这是我的层次结构视图: ->Table view ->Each cell of table is a custom collection view [GitHub Repo][1] ->Each item of collection view has another collection view 我试过的是插入 [self.collectionView.collectionViewLayout invalidateLayout]; 在里面 – (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView 的收集意见。 此外,我已经尝试在做一个重载数据之前使布局无效,不起作用… 任何人都可以给我一些方向吗?

警告:UICollectionViewFlowLayoutcaching了索引path'abc'的帧不匹配

这是导致警告的代码: private override func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? { let attributes = super.layoutAttributesForItemAtIndexPath(indexPath) let distance = CGRectGetMidX(attributes!.frame) – self.midX; var transform = CATransform3DIdentity; transform = CATransform3DTranslate(transform, -distance, 0, -self.width); attributes!.transform3D = CATransform3DIdentity; return attributes } 控制台还打印: 这可能是因为stream布局“xyz”正在修改由UICollectionViewFlowLayout返回的属性而不复制它们。 我如何解决这个警告?