简体   繁体   English

Swift自定义表格视图单元格未解析的标识符

[英]Swift customize table view cell unresolved identifier

I want to customize a table view cell, so I created a new file like the following and did necessary steps mentioned in https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson7.html 我想自定义表格视图单元格,因此我创建了一个类似于以下内容的新文件,并执行了https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson7.html中提到的必要步骤

DetailTableViewCell.swift: 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
}

} }

But when I write var details =Detail(), it will report Use of unresolved identifier 'Detail' . 但是当我写var details = Detail()时,它将报告未解析标识符'Detail'的使用

WHY? 为什么? I just follow the tutorial. 我只是按照教程进行。

class CurrentViewController: UIViewController{

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

You did not define Detail model object. 您没有定义Detail模型对象。

You have to work with this first: 您必须首先使用以下方法:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM