我收到错误 - 使用未声明的类型 'BaseCell' - 尝试按照教程在 Swift 中创建单元格文件



我是一名新程序员(自学成才(,正在按照YouTube教程(https://www.youtube.com/watch?v=PNmuTTd5zWc&t=21s(学习如何编写UICollectionView,该视图为我的应用程序自下而上显示。

当我尝试在第 4:50 分钟内为 BaseCell 创建文件时,我没有收到错误。

使用未声明的类型"基本单元格"

根据教程,这就是它应该的样子

我收到此错误是因为它在 Swift 中不再存在还是可能的错误?

有人可以帮助我吗?

基单元格类是 UIcollection 视图单元格类型的自定义类

class BaseCell: UICollectionViewCell
{
override init(frame: CGRect) {
super.init(frame: frame)
setUpView()
}
func setUpView()
{
}
required init?(coder aDecoder: NSCoder) {
fatalError("init (coder:) has been implemented")
}
}

如果您收到错误使用未声明的类型"BaseCell",然后再次构建您的项目,它将起作用。

最新更新