只是想了解不同项目类型的构建方式,我一定遗漏了一些东西。
我正在尝试从基于窗口的应用程序开始,然后添加一个导航 Controller ,以便了解不同组件如何与 Window 和 App 委托(delegate)一起工作。
这是我所做的:
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
在我的应用程序 delegate.m 中,我添加了:
@synthesize navigationController;
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
窗口
构建干净,当我启动时,我得到一个全白屏。
我错过了什么?
最佳答案
添加此 [self.window addSubview:self.navigationController.view];
您需要将导航 Controller View 添加到窗口。还要确保导航 Controller 的 socket 已连接。您还需要为导航 Controller 添加 Root View Controller
关于iphone - 从基于窗口的项目开始构建基于导航的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7440881/