如何在可差异集合视图中创建动态数量的部分?

huangapple go评论78阅读模式
英文:

How to create dynamic number of sections in diffable UICollectionView?

问题

Diffable datasource 有没有类似 UICollectionView datasource 中后来决定分区数量的方法?

英文:

I know there is a way to decide the number of sections later on if we use the UICollectionView datasource.

func numberOfSections(in collectionView: UICollectionView) -> Int

Just want to know are there any way for diffable datasource?

答案1

得分: 1

UIKit和AppKit中的可区分数据源是声明性的。

这意味着框架不会询问你有多少个部分,而是在准备NSDiffableDataSourceSnapshot时,你会告诉框架有多少个部分。

英文:

The diffable data sources in UIKit and AppKit are declarative.

This means the framework doesn't ask you for the number of sections, instead you tell the framework the number of sections while preparing the NSDiffableDataSourceSnapshot.

huangapple
  • 本文由 发表于 2023年3月7日 17:17:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75660007.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定