1)在我的应用程序委托(delegate)中,我创建了 Root View Controller ,它是一个导航 Controller :
self.navigationController = [[UINavigationController alloc] initWithNibName:@"RootNavigationController" bundle:nil];
self.window.rootViewController = self.navigationController;
2) “RootNavigationController.xib”创建一个 UINavigationController
。它还定义了一个 Root View Controller ,它是一个 CatsViewController : UITableViewController
。有一个 CatsViewController 文件和一个带有 UITableViewController 根对象的“CatsViewController.xib”。就像您在此屏幕截图中看到的那样,我相应地设置了 NIB 名称:
问题是,即使存在 CatsViewController.xib 文件,Xcode 也不让我从下拉列表中选择 CatsViewController。我希望 UINavigationController 的 XIB 创建一个 CatsViewController 实例作为它的根,并且我想通过单独的 nib 文件配置此根 Controller 。
Xcode 警告:
有办法吗?
最佳答案
您收到的错误是由于 AppDelegate 中的 didFinishLaunchingWithOptions
方法尝试初始化窗口而不仅仅是返回 YES。
还在您的代码中更改 RootNavigationController,例如:
self.navigationController = [[UINavigationController alloc] initWithNibName:@"RootNavigationController" bundle:nil];
改成
self.navigationController = [[UINavigationController alloc] initWithNibName:@"CatsViewController" bundle:nil];
关于iphone - 如何在 Interface Builder 中创建以 UITableViewController 作为根的 UINavigationController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12873663/