Question

Je dois soutenir que l'orientation portrait dans mon application. Comment puis-je le faire? Je l'ai essayé d'ajouter

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>

et

 -(BOOL)     shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationPortrait;
}

Mais il does't aide -. La vue tourne de toute façon

Merci à l'avance!

Était-ce utile?

La solution

-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientationshould renvoie un BOOL qui est NOin votre cas.

Autres conseils

Cela devrait être:

 -(BOOL)     shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return interfaceOrientation == UIInterfaceOrientationPortrait 
           || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ;
}

Dans XCode 5 (pas sûr versions antérieures), si vous voulez en mode portrait de soutien seulement à travers l'application entière, allez à projet Paramètres-> Général-> Infos déploiement et décocher Upside Down, Orientation Gauche et Droite Orientation.

Ceci est probablement la meilleure façon de le faire maintenant.

Pour iOS 6, il semble que vous devez ajouter / remplacer cette méthode aussi,

-(BOOL)shouldAutorotate {
    return NO;
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top