【发布时间】:2016-08-24 20:55:47
【问题描述】:
我正在制作一个集合视图,并制作了我自己的自定义 collectionCell。我已经在身份检查员中指定了,据我所知,我做的一切都是正确的。
代码是
import UIKit
class SubjectCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var label: UILabel!
}
在我的 collectionViewController 中
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! SubjectCollectionViewCell
return cell
}
我收到以下错误消息
“无法将 'UICollectionViewCell' (0x110460820) 类型的值转换为 'project.SubjectCollectionViewCell' (0x10eceeda0)。 (lldb)"
【问题讨论】:
-
您确定要从正确的单元格中出列吗?确保重用标识符是正确的,并确保您在界面构建器中设置了自定义单元格。
标签: swift casting uicollectionview