当单元格仍然显示时,UICollectionView中的大单元格将被删除 [英] Large cells in a UICollectionView getting removed while the cell is still displayed

查看:73
本文介绍了当单元格仍然显示时,UICollectionView中的大单元格将被删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含一些大型UICollectionViewCells的UICollectionView。这些单元格太大,以至于它们完全填满UICollectionView边界并延伸到屏幕外。问题是大型单元格从UICollectionView中删除,并在它们仍然显示时排队等待重用,从而产生空白视图。如果我继续滚动空白的UICollectionView区域,最终会出现单元格的最后部分,并且下一个单元格的开头出现在正确的位置。我已经有效地禁用了单元格重用,问题仍然明显发生,因为UICollectionView认为单元格不再显示,因为没有角落在集合视图的范围内。
要演示创建一个单列的集合视图并且具有10000px高的单元格,当滚动非常高的单元格时,它将在大约1000px的内容滚动离开屏幕后消失,并将重新出现以显示最终1000px的单元格内容。
您可以下载一个显示此问题的简单原型应用程序: http://jack.cox.s3 .amazonaws.com / collectionviewprototype.zip

I have a UICollectionView that contains some large UICollectionViewCells. These cells are so large that they completely fill the UICollectionView bounds and extend off screen. The problem is that the large cells are removed from the UICollectionView and queued for reuse while they are still displayed, resulting in a blank view. If I continue scrolling on the blank UICollectionView area, eventually the final portion of the cell appears and the start of the next cell appears in exactly the right place. I've effectively disabled cell reuse and the problem still occurs apparently because the UICollectionView thinks that the cell is no longer displayed since no corner is within the bounds of the collection view. To demonstrate make a collection view that is a single column and have a cell that is 10000px tall, when scrolling over the very tall cell it will disappear after about 1000px of content is scrolled off the screen and will reappear to display the final 1000px of content for the cell. You can download a simple prototype app that displays this problem at: http://jack.cox.s3.amazonaws.com/collectionviewprototype.zip

推荐答案

在调试日志中发生此问题以及此警告:

This issue happened for me along with this warning in the debug log:


未定义UICollectionViewFlowLayout的行为,因为:
项目高度必须小于UICollectionView $的高度b $ b减去了插入顶部和底部值的部分。

the behavior of the UICollectionViewFlowLayout is not defined because: the item height must be less that the height of the UICollectionView minus the section insets top and bottom values.

似乎开箱即用的UICollectionViewFlowLayout不支持大于屏幕。

It seems that the out of the box UICollectionViewFlowLayout does not support cells larger than the screen.

这篇关于当单元格仍然显示时,UICollectionView中的大单元格将被删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆