IBOutlet 未在 SWIFT 中连接 [英] IBOutlet not connecting in SWIFT
本文介绍了IBOutlet 未在 SWIFT 中连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
全部,
我很快就有了这个
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet var tableView: UITableView!
所以如果我进入故事板,我应该能够看到它,并且我应该能够像这样连接它:
So if i go in the storyboard, I should be able to see that, and I should be able to connect it like this :
所以我应该能够转到新引用插座"并将其拖到视图控制器(顶部的黄色选项卡)上,我应该会看到tableView"并连接它.这不会发生,我很困惑为什么!
So I should be able to go to 'New Referencing Outlet' and drag it on the view controller (yellow tab at the top) and I should see 'tableView' and connect it. This doesn't happen , I am confused why !
推荐答案
请勿提前输入以下内容.
Do no type following line in advance.
@IBOutlet var tableView: UITableView! // <-- this line
相反,首先在故事板中添加一个 UIComponent,然后使用辅助编辑器"将连接链接拖到您的 swift 文件中.
Instead, add a UIComponent in your storyboard first and then using "assistant editor" drag the connection link in your swift file.
这篇关于IBOutlet 未在 SWIFT 中连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文