【发布时间】:2011-09-07 09:01:08
【问题描述】:
我尝试寻找类似的问题,但找不到类似的问题。
我在 UIView 中加载 UINavigationController,它不是(在大多数示例中)MainWindow。
我创建了一个名为 DocumentsViewController 的新 .xib,它是 UIView 的子类(它具有相关的 .m 和 .h 文件)。我创建了一个DocumentsRootViewController.xib,它是UITableViewController的子类,应该是UINavigationController的RootViewController。
我移至 DocumentsViewController 并在 Interface Builder 中添加了一个 UINavigationController 对象。然后我去代码,像在 IBOutlet 中一样添加它,并将它连接到对象。
在 ViewDidLoad 中,我执行以下几行:
DocumentsRootViewController *rootViewController = [[[DocumentsRootViewController alloc] init] autorelease];
rootViewController.title = @"Documents";
[navigationControllerDocuments initWithRootViewController:rootViewController];
[self.view addSubview:navigationControllerDocuments.view];
它按预期显示表格,但它显示“根视图控制器”的“返回”按钮(如下图所示)。
为什么?它不应该已经知道 rootviewcontroller 已经设置了吗?
提前感谢那些澄清这个疑问的人
乔瓦尼
【问题讨论】:
标签: iphone ios uiviewcontroller uinavigationcontroller