Dans mon rootViewController, j'ai ré-implémenté la méthode shouldAutorotateToInterfaceOrientation
comme ceci.Méthode ios dev - shouldAutorotateToInterfaceOrientation non appelée pour le mode portrait
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
switch (toInterfaceOrientation) {
case UIInterfaceOrientationPortrait:
NSLog(@"Orientation - Portrait");
break;
case UIInterfaceOrientationLandscapeLeft:
NSLog(@"Orientation - Left");
break;
case UIInterfaceOrientationLandscapeRight:
NSLog(@"Orientation - Right");
break;
case UIInterfaceOrientationPortraitUpsideDown:
NSLog(@"Orientation - UpsideDown");
break;
default:
break;
}
return YES;
}
Lorsque je tourne mon appareil, cette méthode est appelée pour LandscapeRight, LandscapeLeft et UpsideDown, mais pas pour l'orientation Portrait. Au lancement, la vue est en mode portrait et cette méthode est appelée avec UIInterfaceOrientationPortrait. Mais quand je fais tourner l'appareil, cette méthode n'est pas appelée uniquement pour cette orientation.
Je veux faire pivoter le UIImageView central dans ma vue principale sans faire tourner toute l'interface. – Steven