2010-11-18 35 views
0

Şu yolla gezinme denetleyicisi olarak adlandırdığım sekme çubuğu uygulaması üzerinde çalışıyorum Sorun, Yatay modda yönlendirilemedi. Herkes yanlış ne dediğimi söyleyebilir mi?UITabbar uygulamasında yönlendirme sorunları

Selamlar, 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]; 
} 

cevap

1

uygulamanızda 3 sekme çubuğu gibi, bütün sekme çubuğunun EVET olarak shouldrotate fonksiyonunu geçersiz kılmak zorunda u ahbap dinle, orada ilgili sınıf ve

gidin Benim için dua eğer sekme çubuğunun her sınıfı doğrultusunda
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    // Return YES for supported orientations. 

    return YES; 
} 

...

0

o chan mümkün değildir ... o da umut Bir sekme içinde bir görünüm için yönlendirme ve başka biri için değil. Bir TabBar belirtilmişse, tüm alt görünümlerin (sekmeler) aynı yönelimli görünüme sahip olması gerekir. Her ViewController'da ve TabBarController'da yönlendirmeyi ayarlamanız gerekir.

Dolayısıyla, sadece bu kod eklenecek olan bu kontrolörler olan

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

    return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown; 
} 

tüm TabBar ana Kontrolörleri bu eklemek FavouritesViewController, NeedViewController & DontNeedViewController