我不斷收到這個錯誤在我的代碼它說價值的類型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
}
}
可以顯示控制檯錯誤reprort –
這並不是說在控制檯東西。 @ Anbu.Karthik –
請顯示'CellLemon'類,以及您在哪裏註冊了單元格 – anhtu