iOS storyboard 创建 UIColletionViewCell 上的UIImageView 为空

通过storyboard 创建 UIColletionView 可以不用注册cell,但是如果出现下面的错误

reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier FilterCollectionViewCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'


iOS storyboard 创建 UIColletionViewCell 上的UIImageView 为空_第1张图片
图1

解决方法:

设置正确重用的identifier, 而不是 Restoration ID 的 identity 这是加载的时候用的。

iOS storyboard 创建 UIColletionViewCell 上的UIImageView 为空_第2张图片

你可能感兴趣的:(iOS storyboard 创建 UIColletionViewCell 上的UIImageView 为空)