如何将UITabbarcontroller
集成到不在应用代理中的UIViewController
课程中?我想要创建一个登录视图,然后出现在UITabBarController
类中创建的UIViewController
?任何人都可以建议需要做什么?感谢
答案 0 :(得分:1)
您仍然可以将UITabBarController
放在App Delegate中,当登录完成后,只需告诉应用代理,然后切换它们:
self.window.rootViewController = tabBarController;
答案 1 :(得分:-2)
如果您的应用程序是基于导航的应用程序,则创建TabBarController(使用ViewControllers您要添加的数量)并将其添加到导航控制器上,如下所示
UITabBarController *tabBarController = [Utility configureMessagesTabBArController];
self.navigationController.navigationBarHidden=YES;
[self.navigationController pushViewController:tabBarController animated:YES];
[tabBarController release];
这是来自Utility class的 configureMessagesTabBArController 方法
+(UITabBarController *)configureMessagesTabBArController
{
UITabBarController *tabBarController = [[UITabBarController alloc]init];
AktuellesViewController *aktuelles_Controller = [[AktuellesViewController alloc]init];
TermineViewController *termine_Controller = [[TermineViewController alloc]init];
TopTenViewController *topTen_Controller = [[TopTenViewController alloc]init];
MediathekViewController *mediathek_Controller = [[MediathekViewController alloc]init];
KontaktViewController *kontakt_Controller = [[KontaktViewController alloc] init];
UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:aktuelles_Controller];
UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:termine_Controller];
UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:topTen_Controller];
UINavigationController *nav4 = [[UINavigationController alloc]initWithRootViewController:mediathek_Controller];
UINavigationController *nav5 = [[UINavigationController alloc]initWithRootViewController:kontakt_Controller];
nav1.navigationBar.tintColor = [UIColor blackColor];
nav2.navigationBar.tintColor = [UIColor blackColor];
nav3.navigationBar.tintColor = [UIColor blackColor];
nav4.navigationBar.tintColor = [UIColor blackColor];
nav5.navigationBar.tintColor = [UIColor blackColor];
[tabBarController setViewControllers:[[NSArray alloc]initWithObjects:nav1,nav2,nav3,nav4,nav5,nil]];
[nav1 release];
[nav2 release];
[nav3 release];
[nav4 release];
[nav5 release];
[aktuelles_Controller release];
[termine_Controller release];
[topTen_Controller release];
[mediathek_Controller release];
[kontakt_Controller release];
return tabBarController;
}