【发布时间】:2021-07-30 15:53:48
【问题描述】:
我的应用中有第二个 UIcollectionView,它有一个 imageview。 但是每次我都会遇到这样的错误
Thread 1: "could not dequeue a view of kind: UICollectionElementKindCell with identifier SliderCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard"
其中SliderCell 是第一个UICollectionview 的Id
我知道这是因为标识符未注册/拼写错误。我尝试注册。但同样的错误也会发生。
我发现当我将第二个 CollectionView 的委托和数据源添加到同一个 View 时,会发生此错误。
有什么解决办法吗?
【问题讨论】:
-
是的。我已经习惯了diss。标记它们并使用 collectionView.tag 相应地返回值。 (在 cellForItemAt 和 numberOfItemsInSection fns 中。)
-
第二个集合视图是使用滑块单元格、不同的自定义单元格还是 UICollectionViewCell?
-
两个 CollectionViews 是相似的,一个单元格和一个 imageView。第二个细胞有一个差异,ID
标签: ios swift xcode uicollectionview storyboard