在使用Xcode 4.2进行任何类型的iOS 5.0开发之前,Xcode在模板中提供了"MainWindow.xib".下载并使用iOS 5.0使用Xcode 4.2后,我注意到所提供的模板都不包含任何"MainWindow.xib"文件.我们还需要这个吗?我注意到在App_Delegate中的"application didFinishLaunchingWithOptions"方法中,模板现在包含创建一些"UIWindow"的代码,如果你有任何导航控制器,它会相应地更新窗口.
// code that was pulled from a Master Detail application template
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
Run Code Online (Sandbox Code Playgroud)
我想我的问题是,我是否需要更长时间的"MainWindow.xib",如果是这样,那么为什么Apple模板会排除它们呢?