2012-02-21 10 views
0

Je travaille sur une application dans laquelle j'ai un écran de démarrage et un écran d'accueil. Mon application est l'application en mode paysage et portrait. Lorsque mon application démarre et que je suis en mode paysage, mon écran d'accueil affiche le mode portrait pendant quelques secondes et après, il passe en mode paysage. Je veux qu'il devrait montrer directement la vue en mode paysage.Iphone paysage et portrait numéro

Merci

+0

pouvez-vous poster du code? – CarlJ

+0

Avait problème similaire, résolu avec ceci: http://stackoverflow.com/a/10146270/894671 –

Répondre

0

activer habituellement les notifications:

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 

Sur mes contrôleurs i mis:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 
{  
    [self configureOrientation:toInterfaceOrientation]; 
} 

- (void)configureOrientation:(UIInterfaceOrientation)orientation 
{ 

    if(UIDeviceOrientationIsValidInterfaceOrientation(orientation)){ 

     if(UIInterfaceOrientationIsLandscape(orientation)){ 
      [self configureLandscapelView]; 
     }else if(UIInterfaceOrientationIsPortrait(orientation)){ 
      [self configurePortraitlView]; 
     } 
    } 
} 

Vous pouvez également obtenir l'orientation de la UIViewController lui-même:

UIInterfaceOrientation orientation = [self interfaceOrientation]; 

Ou à partir de la barre d'état:

[UIApplication sharedApplication] statusBarOrientation] 
Questions connexes