ios - 为什么 "Use of undeclared type UITableView"发生在 Swift 中?

标签 ios uitableview swift

我是 Swift 的新手。我创建了第二个 swift 文件 调用 DeviceInfo.swift 并在 Main.storyboard 中添加了一个 UIViewcontroller

我还在 UIViewcontroller(DeviceInfo) 中添加了一个 UITableView

但是错误 Use of undeclared type 'UITableView' 在我将 UITableView 连接到 DeviceInfo.swift 后显示> 通过 command + left。错误显示如下。 enter image description here

问题

<强>1。为什么 Use of undeclared type 'UITableView' 发生了?如何解决?

<强>2。显示我将 dataSourcedelegate 连接到 UIViewcontroller(DeviceInfo)

提前致谢。

最佳答案

1.导入 UIKit

2.连接delegatedataSource, 单击该点并拖动到您的 tableView。 enter image description here

关于ios - 为什么 "Use of undeclared type UITableView"发生在 Swift 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28017622/

相关文章:

json - 如何在 iOS 中调用 JSON 方法

iphone - 是否可以通过名称而不是索引以编程方式在受控段中选择一个选项?

ios - 使用 TextView 更新自调整表格 View 单元格的高度

ios - 如何强制 iPhone X 以黑条显示我的应用程序?

ios - 带有 UIWebview 的 UITableViewCell,可根据内容大小调整高度

ios - Swift - 获取图像创建日期和位置

iphone - UIButton 没有出现在 UItableView 最后一节的最后一行

ios - libswiftCore.dylib 中的 UITableviewController 内存泄漏

ios - 检测 iOS App 是否用 Swift 编写

ios - 当我关闭它时,如何从 TableViewController 传递数据?