[英]UICollectionVIew not displaying cells adequately on ios7 although works fine on is6
I have a simple implementation of a UICollectionView
with default layout that works fine on iOS6 . 我有一个具有默认布局的
UICollectionView
的简单实现,该布局在iOS6上运行良好 。 When transitioning the code on iOS7 , the default UICollectionViewFlowLayout
seems not to work: all the cells are located on the top left corner at the exact same locations (one on top of the others). 当在iOS7上转换代码时,默认的
UICollectionViewFlowLayout
似乎不起作用:所有单元格都位于左上角完全相同的位置(一个位于其他位置的顶部)。
Note that I do not update cell.frame.origin, nor cell.center in: 请注意,我不会在以下位置更新cell.frame.origin或cell.center:
(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {}
Am I wrong? 我错了吗? What should I do it?
我该怎么办?
Thank you in advance 先感谢您
I understood my problem: 我了解我的问题:
I had the follwoing line in my code: 我的代码中包含以下行:
[cell.layer setPosition: CGPointMake(-5, -5)];
which explains why the cell was located at the top left corner. 这就解释了为什么该单元位于左上角。
But strangely, when running on ios6, this line had no effect (and that's why I even forgotten it was there) whereas it does have on ios7. 但是奇怪的是,当在ios6上运行时,此行没有任何作用(这就是为什么我什至忘记了它的原因)而在ios7上却有作用。
I simply delete the line, and now everything is running fine on both ios6 and ios7. 我只是删除了这一行,现在ios6和ios7上的一切运行正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.