Logging only once for UICollectionViewFlowLayout cache mismatched frame**
UICollectionViewFlowLayout has cached frame mismatch for index path <NSIndexPath: 0xc000000000200016> {length = 2, path = 0 - 1} - cached value: {{271.25, 41.25}, {117.5, 117.5}}; expected value: {{250, 20}, {160, 160}}**
CollectionView[50664:5115717] This is likely occurring because the flow layout subclass PhotoFlowLayout is modifying attributes returned by UICollectionViewFlowLayout without copying them**
OC解决办法:
NSArray *attrs = [super layoutAttributesForElementsInRect:self.collectionView.bounds];
swift解决办法:
let attributes = super.layoutAttributesForElementsInRect(self.collectionView!.bounds)
var attributesCopy = [UICollectionViewLayoutAttributes]()
for itemAttributes in attributes! {
let itemAttributesCopy = itemAttributes.copy() as! UICollectionViewLayoutAttributes
// manipulate itemAttributesCopy
attributesCopy.append(itemAttributesCopy)
}
查找的文章:
http://stackoverflow.com/questions/32720358/xcode-7-copy-layoutattributes
http://blog.csdn.net/mengxiangyue/article/details/50753839