我有一个 UIViewController,以及一个占据一半屏幕的 UITableView。
我还有一个子类 UITableViewController,但我不知道如何将子类 UITableViewController 与我的表关联起来?
最佳答案
从你的问题中并不清楚你为什么要在这种情况下尝试创建 UITableViewController 和 UIViewController 。您是否有两张不同的 table 想要控制?或者您是否正在尝试做一些特殊的事情,让 2 个不同的 Controller 管理 View / subview 层次结构的不同部分?
通常,UITableViewController 的表是自动创建的或在 NIB 文件中创建。来自 UITableViewController 文档:
If a nib file is specified via the initWithNibName:bundle: method (which is declared by the superclass UIViewController), UITableViewController loads the table view archived in the nib file. Otherwise, it creates an unconfigured UITableView object with the correct dimensions and autoresize mask. You can access this view through the tableView property.
因此,您通常不需要将子类 UITableViewController 与其表相关联,因为这已经为您处理好了。
关于objective-c - 子类 UITableViewController,我在 UIViewController 中的哪里设置它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11412895/