swift - tableView 或 collectionview dequeue 可重复使用如何快速工作

标签 swift uitableview uicollectionview

我已经准备了很多帖子,但我并不清楚它是如何工作的。根据我对性能原因的理解,同一个单元格被重用,但我有一组查询,如

  • 在出队回收过程中,最初在内存中为任何设备创建了多少个单元格,例如是否创建了任何特定数量的单元格,例如 N 个单元格
  • 在滚动时哪个特定的单元格被重用
  • 静态tableview是否支持dequeue

最佳答案

During dequeue recycle how many cells are initially created in memory for any device like is there any specific number of cells are created eg N number of cell

  • 创建 TableView 时所需的函数包含 tableView(_ tv: UITV, numberOfRowsInSection section: Int) -> Int & tableView(_ tv: UITV, numberOfSection section: Int) -> Int 他们俩过去都知道该 TableView 中将显示多少个部分和部分中的行。

On scroll which particular cell gets reused

  • 当 UITableViewCell 滚出屏幕时,它会被放入池中以供重用。 dequeueReusableCell(withIdentifier:) 方法从重用池中获取一个。 如果可能,它会重用具有给定标识符的 UITableViewCell。 否则它会复制 Storyboard中的原型(prototype)。

Does static tableview supports dequeue

  • 静态 TableView 与出列可重用 TableView 相反,因为我们已经知道单元格的数量以及它们的外观。我们不能重复使用它们。

关于swift - tableView 或 collectionview dequeue 可重复使用如何快速工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51855487/

相关文章:

ios - NSMutableArray/UITableView

iphone - 如何在 UITableViewCell 中创建具有圆形背景的数字(如电子邮件应用程序)?

ios - Swift - 从 CollectionViewCell 中的 UIButton 推送到 ViewController

ios - Instagram 故事是在 UICollectionView 还是 UIPageViewController 中?

ios - 无法获取对 UIViewcontroller 的引用

swift - Swift 中的类型检查是如何工作的

iphone - 将 NSarray 项插入指定的 UItableviewcell

ios - 动态调整 UICollectionView 大小以确保没有项目间间距

swift - UIScrollView 可滚动区域未随 ScrollView 框架约束更新而更新

ios - UICollectionViewCell 中的 UICollectionView