2010-06-24 77 views
3

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

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

它应该添加一个全屏导航控制器到当前视图。

回答

0

您可能需要makeKeyAndVisible调用。

+0

据我了解,该窗口是可见的,因为我可以添加其他的东西给子视图,它会工作......眼前这个navigationController让我头疼。 – 2010-06-24 21:37:30

+0

我刚刚开始使用iPhone开发,但是我见过的所有示例都将导航控制器直接添加到UIWindow而不是UIView。也许,鉴于这个控制的全屏幕性质,它想要被添加到窗口?请参阅Apple的文档:http://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/NavigationControllers/NavigationControllers.html#//apple_ref/doc/uid/TP40007457-CH103-SW1 – 2010-06-24 21:56:55

1

我发现一个帖子,UINavigationController not showing the Root View controller,这对我很有用。

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

[self.view addSubview:navigationController.view]; 
[navigationController setView:[[navigationController.viewControllers objectAtIndex:0] view]]; 
相关问题