学習目的でこのような自動回転を実装したかったのです。
デバイスが iPad で実行されている場合、すべての向きがサポートされます。iPhone では、自動回転が許可されません。
自動回転をiOS5 と iOS6の両方で機能させたい。
どのようなコードを書く必要がありますか?
PS。以下のアプローチはうまくいかないようです:
- (BOOL) shouldAutorotate
{
return ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad);
}
-(NSUInteger)supportedInterfaceOrientations
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
{
return UIInterfaceOrientationMaskAll;
}
else
{
return UIInterfaceOrientationMaskPortrait;
}
}