UICollectionView 中的大单元格在仍显示的情况下被删除 [英] Large cells in a UICollectionView getting removed while the cell is still displayed

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

问题描述

我有一个 UICollectionView,其中包含一些大的 UICollectionViewCells.这些单元格非常大,以至于它们完全填满了 UICollectionView 边界并延伸到屏幕外.

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.

问题是大单元格从 UICollectionView 中删除并在它们仍然显示时排队等待重用,从而导致空白视图.如果我继续在空白 UICollectionView 区域上滚动,最终会出现单元格的最后一部分,并且下一个单元格的开头会出现在正确的位置.

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.

我已经有效地禁用了单元格重用,但显然问题仍然存在,因为 UICollectionView 认为单元格不再显示,因为集合视图的范围内没有角.

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.

为了演示制作一个单列的集合视图,并且有一个 10000 像素高的单元格,当滚动到非常高的单元格时,它会在大约 1000 像素的内容滚出屏幕后消失,并重新出现以显示最终单元格内容为 1000 像素.

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.

您可以在以下位置下载一个显示此问题的简单原型应用程序:http://jack.cox.s3.amazonaws.com/collectionviewprototype.zip

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 的行为未定义,因为:项目 height 必须小于 UICollectionView 的高度减去部分 insets topbottom 值.

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天全站免登陆