2010-11-18 9 views
0

Ich arbeite an Tab-Leiste-Anwendung, in der ich Navigation Controller auf folgenden Weg aufgerufen Das Problem ist, ich kann nicht auf Landscape-Modus ausgerichtet werden. Kann mir bitte jemand sagen was ich falsch gemacht habe?Orientierungsprobleme in UITabbar Anwendung

Grüße, 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]; 
} 

Antwort

1

Hören Geck u Sie die shouldrotate Funktion auf YES in all der Tab-Leiste außer Kraft zu setzen haben, wie Sie in Ihrem app 3 Tab-Leiste, gehen, um dort entsprechende Klasse und

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    // Return YES for supported orientations. 

    return YES; 
} 

in all der jeweiligen Klasse der Tab-Leiste ... hoffen, dass Hilfe, wenn es für mich betet ...

0

es ist nicht möglich, chan ge die Ausrichtung für eine Ansicht in einer tabBar und nicht für eine andere. Wenn eine TabBar angegeben wird, müssen alle Unteransichten (Registerkarten) die gleiche Ausrichtung aufweisen. Sie müssen die Ausrichtung in jedem ViewController und im TabBarController festlegen.

So einfach dieses Add in allen wichtigen Controller des Tabbar

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

    return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown; 
} 

in Ihrem Fall diese Controller, auf denen dieser Code hinzugefügt werden soll, sind FavouritesViewController, NeedViewController & DontNeedViewController