xcode - 类型 'CollectionViewCell' 的值没有成员 'imageView'

标签 xcode swift

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

  1. ExploreCollectionViewCell 类型的值没有成员“imageView”
  2. 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
}

storyboard

最佳答案

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

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

    ...
}

关于xcode - 类型 'CollectionViewCell' 的值没有成员 'imageView',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35237296/

相关文章:

swift - VNClassificationObservation 不起作用?

ios - 将二进制文件下载到文档目录 (IOS)。如何?

ios - -Swift.h 头文件中没有名为 'AVCaptureVideoDataOutputSampleBufferDelegate' 的类型或协议(protocol)

swift - 如何在 Xcode 中左对齐导航栏的标题?

objective-c - UIButton 图像调整大小/缩放以适合

swift - WKInterfaceTable 未填充可编码数据

generics - 带有数组的 Swift countElements()

ios - 将 UIImageView 添加到 UIScrollView

iphone - 线程 1 : EXC_BAD_ACCESS (Code = 1, 地址 = 0x30000008) 生成问题

ios - Xcode 7 归档失败