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

这样就不会报这个警告了

相关文章:

  • 2021-12-19
  • 2022-02-04
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2019-06-22
  • 2021-12-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-04
  • 2022-02-07
相关资源
相似解决方案