【发布时间】:2011-12-13 20:22:17
【问题描述】:
在使用 Xcode 4.2 进行任何类型的 iOS 5.0 开发之前,Xcode 在模板中提供了“MainWindow.xib”。在下载并使用带有 iOS 5.0 的 Xcode 4.2 后,我注意到提供的模板都不包含任何“MainWindow.xib”文件。我们还需要这个吗?我注意到在 App_Delegate 的“应用程序 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;
}
我想我的问题是,我还需要“MainWindow.xib”吗?如果需要,那为什么 Apple 模板会排除它们?
【问题讨论】:
标签: xcode interface-builder ios5 xib