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修改

这样就不会报这个警告了

posted @ 2016-01-05 11:22  嗷大喵  阅读(897)  评论(0编辑  收藏  举报