Iphone 子类化UITableViewController您得到了什么?

Iphone 子类化UITableViewController您得到了什么?,iphone,objective-c,cocoa-touch,Iphone,Objective C,Cocoa Touch,这可能是因为我有点糊涂,我正在通过UINavigationController设置UITableViewController,我已经对UITableViewController进行了子类化:(见下文),并实现了datasource方法来启动和运行我的表 @interface RootViewController : UITableViewController { NSArray *dataList; } @property(nonatomic, retain) NSArray *data

这可能是因为我有点糊涂,我正在通过UINavigationController设置UITableViewController,我已经对UITableViewController进行了子类化:(见下文),并实现了datasource方法来启动和运行我的表

@interface RootViewController : UITableViewController {
    NSArray *dataList;
}
@property(nonatomic, retain) NSArray *dataList;
@end
我的问题是:当我开始为RootViewController实现viewDidLoad时,我想为表设置标题(参见下图)。我查看了UITableViewController的文档,发现它有一个名为“tableView”的属性,所以我尝试

[[self tableView] setTitle:@"Eeek!"];
这不起作用,我应该尝试的是

[self setTitle:@"Eeek!"];
我想知道的是,当您将UITableViewController子类化并添加实际处理tableView而不是UITableViewController的代码时,这有意义吗


Gary

您正在设置的实际上是UIViewController(UITableViewController的父类)标题,UINavigationController使用该标题在其导航栏(图像中的蓝色栏)中显示标题


编辑以更好地回答问题:所以,不,当您将UITableViewController子类化时,您实际上是在处理控制器,而不是表视图本身

问题的简短回答,否-您仍在处理控制器的属性。两个
setTitle:
操作之间的区别是:

// This message is being sent to the UITableViewController
[self setTitle:@"Eeek!"];

// This message is being sent to the UITableView property of the UITableViewController
[[self tableView] setTitle:@"Eeek!"];
UITableView
对象上没有
setTitle:
方法,因此失败


抽象地说,就MVC而言,第一个是在控制器上设置属性,第二个是在视图上设置属性。

设置表的标题到底是什么意思?位于表格单元格上方的标题,或导航栏上的标题?位于iPhone状态栏和单元格之间的蓝色栏上的标题(参见上图),标题是“Eeek!”我明白了,title属性实际上位于UIViewController上,由UITableViewController继承。当我无法将“标题”视为UITableViewController的属性时,我感到困惑,现在我完全明白了,它就在那里,你只需要跟着胡子屑走。