将UINavigationController添加到iPhone上的子视图

时间:2010-06-24 21:25:06

标签: iphone objective-c

我一直在尝试将这个UINavigationController添加到我的表单的子视图中...我得到的只是一个大灰色屏幕。

LiteViewController *lite = [[LiteViewController alloc] initWithNibName:@"LiteViewController" bundle:nil];
[self.view addSubview:lite.navigationController.view];

它应该在当前视图中添加全屏导航控制器。

2 个答案:

答案 0 :(得分:1)

我发现了一个对我有用的帖子 UINavigationController not showing the Root View controller

基本上你还需要设置navigationController的视图......

[self.view addSubview:navigationController.view];
[navigationController setView:[[navigationController.viewControllers objectAtIndex:0] view]];

答案 1 :(得分:0)

您可能需要makeKeyAndVisible调用。