iOS9UICollectionView自定义布局modifying attributes returned by UICollectionViewFlowLayout without copying them

UICollectionViewFlowLayout has cached frame mismatch

This is likely occurring because the flow layout subclass MyLineLayout is modifying attributes returned by UICollectionViewFlowLayout without copying them

- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect

NSArray *original = [super layoutAttributesForElementsInRect:rect];

NSArray *array = [[NSArray alloc] initWithArray:original copyItems:YES];

对array进行修改就可以了,不要对original修改

这样就不会报这个警告了

上一篇:AABB碰撞盒


下一篇:MVC(一)-MVC的基础认知