2010-11-17 6 views
-1

J'utilise des onglets personnalisés (3 onglets) dans mon application. Chaque onglet est contrôlé par le contrôleur de navigation comme indiqué ci-dessous. Le problème est que lorsque l'autorotation est en cours, chaque autorotation prend fin sur le contrôleur racine mais le contrôleur enfant (shouldAutorotateToInterfaceOrientation) ne répond pas.iphone autorotate issue

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

UINavigationController *localNavigationContriller; 

    XXXViewController *mail; 
    xxx = [[XXXViewController alloc] initWithTabBar]; 

    localNavigationContriller=[[UINavigationController alloc] initWithRootViewController:xxx]; 
    [localNavigationContriller.navigationBar setBarStyle:UIBarStyleDefault]; 
    localNavigationContriller.navigationBar.tintColor = [UIColor colorWithRed:134/255.0 green:187/255.0 blue:34/255.0 alpha:1]; 
    [localControllersArray addObject:localNavigationContriller]; 
    [localNavigationContriller release]; 
    [xxx release]; 

    YYYViewController *rsvn; 
    yyyy = [[YYYViewController alloc] initWithTabBar]; 


    localNavigationContriller=[[UINavigationController alloc] initWithRootViewController:yyyy]; 
    [localNavigationContriller.navigationBar setBarStyle:UIBarStyleDefault]; 
    localNavigationContriller.navigationBar.tintColor = [UIColor colorWithRed:134/255.0 green:187/255.0 blue:34/255.0 alpha:1]; 
    [localControllersArray addObject:localNavigationContriller]; 
    [localNavigationContriller release]; 
    [yyyy release]; 


    TempController *tem; 
    tem = [[TempController alloc] initWithTabBar]; 


    localNavigationContriller=[[UINavigationController alloc] initWithRootViewController:calendar]; 
    [localNavigationContriller.navigationBar setBarStyle:UIBarStyleDefault]; 
    localNavigationContriller.navigationBar.tintColor = [UIColor colorWithRed:134/255.0 green:187/255.0 blue:34/255.0 alpha:1]; 
    [localControllersArray addObject:localNavigationContriller]; 
    [localNavigationContriller release]; 


    tabBarController.delegate=self; 
    tabBarController.viewControllers = localControllersArray; 

    [localControllersArray release]; 
+0

essaie d'utiliser la fonction de code de cet éditeur ici. – WrightsCS

Répondre

0

Apple a guide spécifique à cette situation:

http://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CombiningViewControllers/CombiningViewControllers.html#//apple_ref/doc/uid/TP40007457-CH104-SW8

... Avez-vous essayé la suite de l'installation d'Apple?

Votre code source ci-dessus est impossible, il ne compilerait jamais. Votre description du problème est incomplète (dont le contrôleur racine est en panne? La racine de navigation, ou l'onglet racine?).

Mais ... essayez d'ajouter:

shouldAutorotateToInterfaceOrientation 

à chaque un de vos contrôleurs, et faire de chacun faire NSLog. Habituellement, vous trouverez que l'un d'entre eux (de façon inattendue) reçoit ce message, mais aucun de ses enfants ne l'est. Cela signifie généralement que vous avez omis de le dire à propos de certains de ses enfants, mais vous devriez être capable de le réduire.