我试图把一个一个的UITabBarController UINavigationController的(编程)里面,这是我的代码:的UITabBarController UINavigationController的中
UITabBarController *tabBarController = [[UITabBarController alloc] init];
HomeViewPhone *home = [[HomeViewPhone alloc] initWithStyle:UITableViewStylePlain];
home.title = NSLocalizedString(@"HOME",nil);
EventiPhone *eventi = [[EventiPhone alloc] initWithStyle:UITableViewStylePlain];
eventi.title = NSLocalizedString(@"EXPLORE", nil);
FavoritiPhone *favoriti = [[FavoritiPhone alloc] initWithStyle:UITableViewStylePlain];
favoriti.title = NSLocalizedString(@"FAVORITES",nil);
ProfiloPhone *profilo = [[ProfiloPhone alloc] initWithStyle:UITableViewStylePlain];
profilo.title = NSLocalizedString(@"PROFILE", nil);
[tabBarController setViewControllers:[NSArray arrayWithObjects:home,eventi,favoriti,profilo, nil]];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:tabBarController];
[self.window addSubview:navController.view];
,但是当我点击一个TabBarItem的应用程序崩溃,此错误
-[__NSCFString _tabBarItemClicked:]: unrecognized selector sent to instance 0x7934db0
有没有想法?使用
self.window.rootViewController = tabBarController;
而不是
[self.window addSubview:navController.view];
正如一个注:根据苹果的指导方针,你通常应该把导航控制器内的标签栏控制器,而不是其他的方式。 – mrueg 2011-12-16 23:05:14
同样的问题:/ – 2011-12-17 11:37:18