2011-12-14 55 views

回答

1

你仍然可以把UITabBarController在App代表,當登錄完成後,只是告訴應用程序的委託,並切換它們:

self.window.rootViewController = tabBarController;

+0

您是否有該先生的任何源代碼?謝謝 – Jahn 2011-12-14 08:31:32

+1

你不需要代碼,你需要了解。在AppDelegate中有兩個IBOUtlets。一個用於登錄UIViewController,另一個用於UITabBarController。在開始時,把你的登錄UIViewController的你的rootViewController,當你完成它,只需切換爲你的UITabBarController rootViewController。 – Peres 2011-12-14 08:40:17

-2

,如果你的應用程序是基於導航應用,然後創建TabBarController(與ViewControllers你要多少添加),並將其添加上導航控制器,這樣

UITabBarController *tabBarController = [Utility configureMessagesTabBArController]; 
self.navigationController.navigationBarHidden=YES; 
[self.navigationController pushViewController:tabBarController animated:YES]; 
[tabBarController release]; 

這裏是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; 
} 
相關問題