【问题标题】:What is prefetchDataSource in UITableView?UITableView 中的 prefetchDataSource 是什么?
【发布时间】:2018-04-17 12:39:18
【问题描述】:

我在一个屏幕上工作,我在datasourcedelegate 的列表中看到了UITableViewprefetchDataSource。有人能解释一下它的用途和使用方法吗?

附上截图供参考。

【问题讨论】:

标签: ios uitableview xcode9


【解决方案1】:

UITableViewDataSource 预取将帮助您提高 TableView 的平滑滚动和性能,方法是提前为用户向下滚动时可见的下一行预取数据。

prefetchDataSource 是充当表格视图的预取数据源的对象,接收即将到来的单元格数据需求的通知。

UITableViewDataSourcePrefetching 协议 UITableView 和 UICollectionView 从 iOS 10 开始可用。委托函数 tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) 将在行接近显示区域时调用,您可以调用 web API并将它们加载到这个委托函数中。

更多信息请参考:-

https://fluffy.es/prefetching/

https://developer.apple.com/documentation/uikit/uitableviewdatasourceprefetching?language=objc

【讨论】:

  • 链接和抄袭段落不是答案。
猜你喜欢
  • 1970-01-01
  • 2012-08-14
  • 2012-09-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多