【问题标题】:Does the UITableView "beginUpdates" and UICollectionView "performBatchUpdates" have the same behavior?UITableView "beginUpdates" 和 UICollectionView "performBatchUpdates" 是否具有相同的行为?
【发布时间】:2014-08-04 18:54:17
【问题描述】:

当我开始想知道 UITableView 中的“beginUpdates”和 UICollectionView 中的“performBatchUpdates”是否具有相同的行为时,我正在浏览文档。如果是这样,即使它们实际上是同一个东西,它们是否有不同的称呼?

谢谢!

【问题讨论】:

    标签: ios uitableview uicollectionview


    【解决方案1】:

    UITableViewbeginUpdates 必须与对endUpdates 的调用相匹配。 UICollectionViewperformBatchUpdates:completion 方法不需要您在进行更新时回调到集合视图,这可能是因为您传递的用于更新集合视图的工作块包含在这些调用中.

    UITableView 早于被添加到 Objective-C 的块。我怀疑 UITableView 没有类似 API 的原因是它的公共 API 是在合并块之前设计的。

    【讨论】:

    • 自 2020 年起,UITableViewbeginUpdatesendUpdates 被标记为“将在未来的版本中弃用”。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-19
    • 1970-01-01
    • 1970-01-01
    • 2012-09-21
    • 1970-01-01
    • 2016-03-19
    • 1970-01-01
    相关资源
    最近更新 更多