使用选项卡式ipad应用程序。我的程序构建但无法启动AppDelegate.m,
中此行中的错误self.tabBarController.viewControllers = @[viewController1, viewController2];
此代码尚未编辑,即直接从模板编辑,并且直到现在才正常工作。视图控制器似乎启动,并在调试时在检查器中显示有效属性。我假设NSrange错误是指self.tabBarController.viewControllers数组,也许这不是真的。
抱歉,错误出现在我自己的代码中,请忽略。
答案 0 :(得分:0)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
UIViewController *viewController_favorites = [[[FavoritesViewController alloc] initWithNibName:@"FavoritesViewController" bundle:nil] autorelease];
UIViewController *viewController_project = [[[ProjectViewController alloc] initWithNibName:@"ProjectViewController" bundle:nil] autorelease];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController_favorites,viewController_project, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
}