UICollectionViewFlowLayout has cached frame mismatch for index path
来源:互联网 发布:it管培生 编辑:程序博客网 时间:2024/05/18 23:27
在升级XCode7.0使用UICollectionViewLayout进行自定义布局时,调试台会出现以下的警告打印。
UICollectionViewFlowLayout has cached frame mismatch for index path {length = 2, path = 0 - 0} - cached value: {{122, 15}, {170, 170}}; expected value: {{157, 50}, {100, 100}}
This is likely occurring because the flow layout subclass LineLayout is modifying attributes returned by UICollectionViewFlowLayout without copying them
这个警告来源主要是在使用layoutAttributesForElementsInRect:方法返回的数组时,没有使用该数组的拷贝对象,而是直接使用了该数组。解决办法对该数组进行拷贝,并且是深拷贝。拷贝代码如下:
- (NSArray *)deepCopyWithArray:(NSArray *)array{ NSMutableArray *copys = [NSMutableArray arrayWithCapacity:array.count]; for (UICollectionViewLayoutAttributes *attris in array) { [copys addObject:[attris copy]]; } return copys;}
将layoutAttributesForElementsInRect:方法返回的数组扔到这个方法中,并且使用返回后的数组就行了。
1 0
- UICollectionViewFlowLayout has cached frame mismatch for index path
- UICollectionViewFlowLayout has cached frame mismatch for index path <NSIndexPath: 0xc000000001400016
- Logging only once for UICollectionViewFlowLayout cache mismatched frame
- pkg: cached package *:size mismatch, cannot continue
- UICollectionViewFlowLayOut
- No index path for table cell being reused 这个问题
- svn: Checksum mismatch for
- svn: Checksum mismatch for
- An error has occurred. See error log for more details. Index out of bounds问题处理
- [错误]java.lang.IllegalArgumentException: Index for header 'XXX' is 1 but CSVRecord only has 1 val
- UICollectionView recieved layout attributes for a cell with an index path that does not exist 解决办法
- layoutAttributesForElementsInRect: Logging only once for UICollectionViewFlowLayout cache mismatched
- mismatch
- mismatch
- error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL'
- 报错svn: E200014: Checksum mismatch for
- SVN提交出现Checksum mismatch for '.........';
- svn报错“Checksum mismatch for”解决方案
- 一个线性优化问题--仓库配货
- String 和 ArrayList 之间的转换
- LeetCode---206reverse-linked-list
- Linux战地日记—系统管理
- Leetcode118: Longest Palindromic Substring
- UICollectionViewFlowLayout has cached frame mismatch for index path
- Android 基于google Zxing实现二维码、条形码扫描,仿微信二维码扫描效果
- bzoj1673: [Usaco2005 Dec]Scales 天平
- android layout的一些注意事项
- 为什么要用new来建立一个对象
- C++ Primer Week1
- [ARM7--LPC2478]Power及Clock
- Python常见异常问题
- SDWebImage 涉及知识点位移枚举的操作解析