objective-c - 子类 UITableViewController,我在 UIViewController 中的哪里设置它?

标签 objective-c ios uitableview

我有一个 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/

相关文章:

iphone - 如何在iphone应用程序中获取经纬度的地址

iOS:自定义后退按钮不起作用

objective-c - AF网络框架: how to cache image

iphone - 如何控制UISearchDisplayController自己的table view?

ios - 在 ios 应用程序中获取某人的 facebook 公开个人资料

objective-c - 我如何获得 MPAVController "setting movie path"

iphone - 通用应用程序适用于 iPad 1,但不适用于 iPad 2

iOS混合模式相乘

objective-c - 将图像动态加载到 TableView 单元格中

ios - 过滤 NSFetchedResultsController 以仅获取具有某种关系的对象