英文:
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
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论