iPhone - Interface Orientation inversée?
-
21-09-2019 - |
Question
Salut j'ai ce morceau de code ...
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
et
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(UIInterfaceOrientationIsPortrait(interfaceOrientation)){
// WTF, this runs when I change to Landscape
} else {
// this runs when I change to Portrait??? shouldn't it be the contrary?
}
}
comme vous le voyez, le code est en cours d'exécution en sens inverse, je veux dire, la partie la devrait fonctionner lorsque je change l'appareil portrait, la partie du paysage des pistes de code et vice-versa.
Quand je tourne l'appareil, self.view tourne.
est ce test de UIInterfaceOrientationIsPortrait comment l'interface est avant la rotation ou suis-je manque quelque chose?
Merci pour toute aide.
La solution
Notez que la méthode est appelée didRotate De InterfaceOrientation, si naturellement le paramètre interfaceOrientation
contient l'ancienne orientation, pas le nouveau.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow