【问题标题】:Swift customize table view cell unresolved identifierSwift 自定义表格视图单元格未解析的标识符
【发布时间】:2016-04-20 07:49:55
【问题描述】:

我想自定义一个表格视图单元格,所以我创建了一个如下所示的新文件并执行了https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson7.html中提到的必要步骤

DetailTableViewCell.swift:

import UIKit

class DetailTableViewCell: UITableViewCell {

@IBOutlet weak var titleLabel: UILabel!

@IBOutlet weak var contentLabel: 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
}

}

但是当我写 var details =Detail() 时,它会报告Use of unresolved identifier 'Detail'

为什么?我只是按照教程。

class CurrentViewController: UIViewController{

var details=[Detail]()
...
}

【问题讨论】:

  • 细节未定义尝试 var details=[DetailTableViewCell]()
  • 你定义了Detail模型对象吗?

标签: ios xcode swift customization tableviewcell


【解决方案1】:

您没有定义Detail 模型对象。

你必须先处理这个:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-04-29
    • 1970-01-01
    • 2014-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-29
    • 1970-01-01
    相关资源
    最近更新 更多