当我使用 Xcode 版本 4.5.2 (4G2008a) 为通用应用程序 5.0 及更高版本创建新的“选项卡式应用程序”时,它在 6.0 模拟器上运行良好,但在 5.1 或 5.0 上运行良好。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *viewController1;
UIViewController *viewController2;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController_iPhone" bundle:nil];
viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController_iPhone" bundle:nil];
} else {
viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController_iPad" bundle:nil];
viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController_iPad" bundle:nil];
}
self.tabBarController = [[UITabBarController alloc] init];
**self.tabBarController.viewControllers = @[viewController1, viewController2];**
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
这是断点捕获的地方 self.tabBarController.viewControllers = @[viewController1, viewController2];
我没有改变苹果设置的任何内容。我看过,但也许我在谷歌上搜索错误的东西。