あなたはそれが何のためにあるのか誤解していると思いますshouldAutorotateToInterfaceOrientation:
。「どの方向をサポートしますか?」と尋ねているのではありません。、「このインターフェイスの向きをサポートしていますか?」と尋ねられます。。したがって、答えはまたはのいずれかである必要があります。YES
NO
向きを変えることを決定する前に毎回これを尋ねるので、あなたは考えを変えて、時にはそれをサポートすることができますが、そうでない場合もあります(本当に必要な場合)。
たとえば、すべての方向をサポートするには:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
...横向きのみをサポートするには:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||
(interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
...横向きのみをサポートするには(必要に応じて):
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return(interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}