Xcode 类型为'的值;CollectionViewCell';没有成员';imageView';

Xcode 类型为'的值;CollectionViewCell';没有成员';imageView';,xcode,swift,Xcode,Swift,由于以下两个错误,我的构建失败 ExploreCollectionViewCell类型的值没有成员“imageView” ExploreCollectionViewCell类型的值没有成员“titleLabel” 我不知道是什么变化导致了失败,或者如何在不重做整个项目的情况下修复它 func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> U

由于以下两个错误,我的构建失败

  • ExploreCollectionViewCell类型的值没有成员“imageView”
  • ExploreCollectionViewCell类型的值没有成员“titleLabel”
  • 我不知道是什么变化导致了失败,或者如何在不重做整个项目的情况下修复它

    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    
        let cellApt = collectionView.dequeueReusableCellWithReuseIdentifier("cellApt", forIndexPath: indexPath) as! ExploreCollectionViewCell
    
        cellApt.imageView?.image = self.imageArray[indexPath.row]
        cellApt.titleLabel?.text = self.condoCells[indexPath.row]
        cellApt.setNeedsLayout()
    
        return cellApt
    }
    

    更换:

    让cellApt=collectionView.dequeueReusableCellWithReuseIdentifier(“cellApt”,forIndexPath:indexPath)作为!ExploreCollectionViewCell

    与:


    让cellApt:ExploreCollectionViewCell=collectionView.dequeueReusableCellWithReuseIdentifier(“cellApt”,forIndexPath:indexPath)作为!ExploreCollectionViewCell

    ExploreCollectionViewCell应具有如下代码所示的属性:

    class ExploreCollectionViewCell: UICollectionViewCell {
        @IBOutlet weak var imageView: UIImageView!
        @IBOutlet weak var titleLabel: UILabel!
    
        ...
    }
    

    在ExploreCollectionViewCell类中,是否添加了imageView和titleLabel的属性?我没有。我需要添加哪些属性?我刚刚添加了一个示例作为答案。很抱歉,很遗憾,这不起作用。谢谢你的时间和努力