如何将Table dataSource和委托出口链接到UITableViewController? [英] How to link Table dataSource and delegate outlets to UITableViewController?
问题描述
我是Swift / iOS开发的新手。
I'm new to Swift/iOS development.
我的<$ c中有一个 UITableView
$ c> storyboard 我想填充一些数据。在我尝试这样做时,我创建了一个继承自 UITableViewController
的类。实现还没有完成,但我的理解是,通过继承这个类,我可以为 dataSource
IBOutlet >和委托
。
I have a UITableView
in my storyboard
that I want to populate with some data. In my attempt to do so, I created a class that inherits from UITableViewController
. The implementation is not yet complete, but my understanding is that by inheriting from this class I can provide an IBOutlet
to both dataSource
and delegate
.
当我尝试将插座拖到源文件中时,我没有得到我之前测试时得到的插入点。见下图:
When I try to drag the outlet into the source file, I don't get the insertion point that I got when I tested this before. See image below:
我需要做什么才能将此类定义为处理程序 UITableView
?
What do I have to do to define this class as the handler for the UITableView
?
推荐答案
在故事板中,选择 UITableView
并将其更改为 UITableViewController
子类的名称。然后您不需要进行任何链接。
In your storyboard, select the UITableView
and change this to the name of your UITableViewController
subclass. You then do not need to do any linking stuff.
这篇关于如何将Table dataSource和委托出口链接到UITableViewController?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!