2010-11-18 8 views
0

私は次のようにナビゲーションコントローラと呼ばれるタブバーアプリケーションに取り組んでいます 問題は私が横向きモードに向けることができません。私が間違っていたことを誰でも言いたいことはありますか?UITabbarアプリケーションでのオリエンテーションの問題

よろしく、 サティッシュ

-(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

は、uはあなたがあなたのアプリで3タブバーを持っているように、すべてのタブバーでYESにshouldrotate関数をオーバーライドしますが、それぞれのクラスに行くと

する必要が男を聞きますタブバーの全てそれぞれのクラスで ​​

...それは私のために祈っていなければ、その助けを願っています...

0

それはちゃんすることはできませんtabBarの1つのビューの向き。別のものの向きはありません。 TabBarが指定されている場合は、すべてのサブビュー(タブ)の向きが同じでなければなりません。それぞれのViewControllerとTabBarControllerで方向を設定する必要があります。

だから、このコードを追加するこれらのコントローラがある

あなたのケースで
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
     return YES; 

    return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown; 
} 

すべてのタブバーのメインコントローラでこれを追加し FavouritesViewController, NeedViewController & DontNeedViewController