我创建了一个collectionViewFlowLayout
的子类,然后实现了以下代码:
override func finalLayoutAttributesForDisappearingItemAtIndexPath(itemIndexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? {
let attr = self.layoutAttributesForItemAtIndexPath(itemIndexPath)
attr?.transform = CGAffineTransformRotate(CGAffineTransformMakeScale(0.8, 0.8), CGFloat(M_PI))
attr?.center = CGPointMake(CGRectGetMidX(self.collectionView!.bounds), CGRectGetMidY(self.collectionView!.bounds))
return attr
}
当我使用
performBatchUpdates
方法在集合视图中删除项目时,调试器会抛出此错误消息。实际上,删除成功并且完全工作,但是我对这个调试器输出有点困惑。请问有人可以解释一下我应该做些什么来满足调试器的要求吗?我不太理解应该添加什么代码以及在哪里添加。//错误消息
2015-08-02 12:39:42.208 nameOfMyProject[1888:51831] 只记录一次 for UICollectionViewFlowLayout cache mismatched frame 2015-08-02 12:39:42.209 nameOfMyProject[1888:51831] UICollectionViewFlowLayout has cached frame mismatch for index path {length = 2, path = 0 - 11} - cached value: {{106.13333333333333, 131.13333333333333}, {75.733333333333348, 75.733333333333348}}; expected value: {{192.5, 288}, {94.666666666666671, 94.666666666666671}}
2015-08-02 12:39:42.209 nameOfMyProject[1888:51831] 这可能是因为流布局子类nameOfMyProject.ShopLayout正在修改UICollectionViewFlowLayout返回的属性而没有复制它们
2015-08-02 12:39:42.209 nameOfMyProject[1888:51831] 快照一个未被渲染的视图将导致一个空的快照。确保您的视图至少被渲染一次,然后再进行快照或在屏幕更新后进行快照。
NSArray *allAttributesInArray = [[super layoutAttributesForElementsInRect:rect] copy];
的事情,但那似乎也不起作用。 - wanderingme