swift - UI 表格 View Controller

标签 swift

class HomeViewController: UIViewController, UITableViewDelegate,     UITableViewDataSource
 {

code

}

在使用TableViewController时,我删除了这两个类/接口(interface)UITableViewDataSource、 UITableViewDelegate。仍然工作正常。 为什么?

class HomeViewController: UIViewController
{

 code

}

那么我们为什么要使用这些类呢?

最佳答案

它仍然有效,因为 UITableViewController 已经实现了委托(delegate) UITableViewDelegateUITableViewDataSource :)

关于swift - UI 表格 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33711389/

相关文章:

ios - 如何在 Swift 中访问 iOS 私有(private) API?

ios - 动画 TableView 高度约束但动画正在跳跃

ios - 调用文本字段委托(delegate)之前需要的键盘高度

ios - 取消本地通知

swift - 如何实现加载屏幕

ios - 我在 swift2 中使用 objective-c 类,如何实现委托(delegate)方法并绑定(bind)该委托(delegate)

ios - 如何在 xcode 中使 5 个按钮的水平宽度相同

swift - 如何根据 bool 属性对 Realm 结果进行排序

swift - 如何在 Apple TV 上制作播放/暂停按钮远程播放/暂停 AVAudioPlayer

ios - 如何在 Swift 中使用 WKwebView 制作事件指示器