ios - Swift自定义表格 View 单元格未解析的标识符

标签 ios xcode swift customization uitableview

我想自定义一个表格 View 单元格,因此我创建了一个如下所示的新文件,并执行了 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 unresolvedidentifier 'Detail'

为什么?我只是按照教程进行操作。

class CurrentViewController: UIViewController{

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

最佳答案

您没有定义Detail模型对象。

你必须先处理这个:

enter image description here

关于ios - Swift自定义表格 View 单元格未解析的标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36737186/

相关文章:

ios - Objective C iOS在圆弧上绘制矩形

ios - 从 UICollectionView 到 UILabel 的 myLabel 导出无效。 socket 无法连接到重复内容

xcode - Mac os x/usr/bin/gcc 文件

swift - 如何防止 NSCursor 发生变化?

ios - 为什么我们在声明自定义 View 时不必使用 "frame"?

iphone - 执行 FMDB 插入查询但未在数据库中插入数据

ios - 如何访问属性列表

iphone - 如何从 iOS 中的 FTP URL 在 ImageView 上加载图像

ios - 两个类,相同的属性名称,不同的类型 -> 被覆盖

ios - 自定义分段控件宽度代码没有故意工作