ios - 类型 UIView 的值没有成员错误

标签 ios swift uiview

我的代码中不断出现此错误,它说 UIView 类型的值没有成员。

这是代码。

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    let cell: CellLemon = tableView.dequeueReusableCellWithIdentifier("Cell") as! CellLemon

    cell.cellTopLabel.text = CarMake[indexPath.row]

    cell.cellBottom.text = CarModel[indexPath.row]

    var imageName = UIImage(named: CarImage[indexPath.row])

    cell.cellImage.image = imageName



    // Configure the cell...

    return cell
}

有问题的代码是这样的,

cell.cellImage.image = imageName

这是 cellLemon 类。这正是你们所要求的。

import UIKit

class CellLemon: UITableViewCell {


@IBOutlet weak var cellImage: UIView!

@IBOutlet weak var cellTopLabel: UILabel!

@IBOutlet weak var cellBottom: UILabel!


override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
}

override func setSelected(selected: Bool, animated: Bool) {
    super.setSelected(selected, animated: animated)

    // Configure the view for the selected state
}

}

最佳答案

你错了。请仔细检查并修复它

@IBOutlet weak var cellImage: UIView! // why cellImage is UIView?

关于ios - 类型 UIView 的值没有成员错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35859175/

相关文章:

objective-c - UIView 仅设置侧边框

ios - 在 iOS 中实现音频波形 View 和音频时间轴 View ?

ios - 如何使用 GPUImageHarrisCornerDetectionFilter 检测图像的角点

swift - 确定 Collection View 单元格的大小

objective-c - 在iPhone应用程序中执行核心图时出现错误:“-[UIView setHostedGraph:]:无法识别的选择器”

ios - 如何获取保存的字符串并在 swift 中使用另一个 View Controller ?

ios - UIPopOverPresentationController 在presentationTransitionWillBegin 上崩溃

ios - UILabel 怎么不实现 intrinsicContentSize?

ios - 在从 Firebase DB 获取结果的 UITableView 上实现搜索

ios - 如何在 swift 中使用单例访问另一个 Controller 中的模型类值?