Même moi j'ai fait face au problème, Si vous voulez juste savoir si l'orientation de l'appareil a changé ou pas utiliser la notification au lieu de shouldAutorotateToInterfaceOrientation.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
-(void)orientationChanged:(NSNotification *)dict
{
UIInterfaceOrientation interfaceOrientation = (UIInterfaceOrientation)[UIDevice currentDevice].orientation;
//Your code
}
Pour le problème d'origine, Par défaut shouldAutorotateToInterfaceOrientation retour OUI pour UIDeviceOrientationPortrait Si vous êtes retourné NO dans méthode shouldAutorotateToInterfaceOrientation, dispositif pensera que son en le mode UIDeviceOrientationPortrait ne donc la méthode shouldAutorotateToInterfaceOrientation n'est pas appelé UIDeviceOrientationPortrait.
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
//your code
return NO;
}
Pas assez d'informations. Vous devriez publier le code là où cela arrive. –