2010-11-18 62 views
0

我正在標籤欄應用程序中,我在下面的方式調用導航控制器 問題是我無法能夠面向景觀模式。任何人都可以說我錯了什麼?UITabbar應用程序的方向問題

問候, Sathish所在

-(IBAction)click 


{ 

    tabBarController = [[UITabBarController alloc] init]; 

    NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:5]; 

    UINavigationController *localNavigationContriller; 

    FavouritesViewController *master; 
    master = [[FavouritesViewController alloc] initWithTabBar]; 
    localNavigationContriller=[[UINavigationController alloc] initWithRootViewController:master]; 
    [localNavigationContriller.navigationBar setBarStyle:UIBarStyleBlackTranslucent]; 
    [localControllersArray addObject:localNavigationContriller]; 
    //[localNavigationContriller release]; 
    [master release]; 

    NeedViewController *need; 
    need = [[NeedViewController alloc] initWithTabBar]; 
    localNavigationContriller=[[UINavigationController alloc] initWithRootViewController:need]; 
    [localNavigationContriller.navigationBar setBarStyle:UIBarStyleBlackTranslucent]; 
    [localControllersArray addObject:localNavigationContriller]; 
    //[localNavigationContriller release]; 
    [need release]; 

    DontNeedViewController *dontneed; 
    dontneed = [[DontNeedViewController alloc] initWithTabBar]; 
    localNavigationContriller=[[UINavigationController alloc] initWithRootViewController:dontneed]; 
    [localNavigationContriller.navigationBar setBarStyle:UIBarStyleBlackTranslucent]; 
    [localControllersArray addObject:localNavigationContriller]; 
    //[localNavigationContriller release]; 
    [dontneed release]; 

    tabBarController.delegate=self; 
    tabBarController.viewControllers = localControllersArray; 
    [localControllersArray release]; 

    [[[UIApplication sharedApplication] keyWindow] addSubview:tabBarController.view]; 
} 

回答

1

聽着夥計ü你必須重寫shouldrotate功能是在所有的標籤欄,就像你在你的應用程序3標籤欄,轉到有相應的等級和

​​ 在所有的相應類別的標籤欄的

...希望幫助,如果它不爲我祈禱...

0

這是不可能的陳爲tabBar中的一個視圖指定方向,而不是另一個視圖。如果指定了TabBar,則所有子視圖(製表符)必須具有相同的方向外觀。您必須在每個ViewController和TabBarController中設置方向。

因此,只要在使用TabBar的所有主控制器

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
     return YES; 

    return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown; 
} 

你的情況的控制器,其中該代碼是要添加的添加此 FavouritesViewController, NeedViewController & DontNeedViewController