Iphone 如何在Interface Builder中创建UITableViewController作为根用户的UINavigationController?
1) 在我的应用程序委托中,我创建了根视图控制器,它是一个导航控制器:Iphone 如何在Interface Builder中创建UITableViewController作为根用户的UINavigationController?,iphone,ios,xcode,xcode4,interface-builder,Iphone,Ios,Xcode,Xcode4,Interface Builder,1) 在我的应用程序委托中,我创建了根视图控制器,它是一个导航控制器: self.navigationController = [[UINavigationController alloc] initWithNibName:@"RootNavigationController" bundle:nil]; self.window.rootViewController = self.navigationController; 2) “RootNavigationController.xib”创建一
self.navigationController = [[UINavigationController alloc] initWithNibName:@"RootNavigationController" bundle:nil];
self.window.rootViewController = self.navigationController;
2) “RootNavigationController.xib”创建一个UINavigationController
。它还定义了根视图控制器,它是一个CatsViewController:UITableViewController
。有一个CatsViewController文件和一个带有UITableViewController根对象的“CatsViewController.xib”。正如您在这个屏幕截图中看到的,我相应地设置了NIB名称:
问题是,即使存在CatsViewController.xib文件,Xcode也不允许我从下拉列表中选择CatsViewController。我希望UINavigationController的XIB创建一个CatsViewController实例作为其根,并希望通过一个单独的nib文件配置此根控制器
Xcode警告:
有办法吗?您遇到的错误是由于AppDelegate中的
didfishLaunchingWithOptions
方法试图初始化窗口,而不是仅仅返回YES
另外,在代码中更改RootNavigationController,如:
self.navigationController = [[UINavigationController alloc] initWithNibName:@"RootNavigationController" bundle:nil];
换成
self.navigationController = [[UINavigationController alloc] initWithNibName:@"CatsViewController" bundle:nil];