【发布时间】:2018-04-27 13:44:24
【问题描述】:
我目前正在从事一个项目,其中我注册了一个 CollectionViewController 和多个单元格。我需要帮助来返回我希望为每个单元格显示的单元格数。
例如我已经注册:
collectionView?.register(PhotoCell.self, forCellWithReuseIdentifier: picCell)
collectionView?.register(ArticleCell.self, forCellWithReuseIdentifier: articleCell)
如您所见,我已经注册了两个单元格。如何以编程方式返回 7 个照片单元格和 4 个文章单元格以显示在我的收藏视图中?
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 7
}
截至目前,我只能成功归还 7 个光电池。
【问题讨论】:
标签: ios swift uicollectionview uicollectionviewcell xcode9