メインビューでいくつかの UIImageViews を処理する UIViewController があります。下部には、対話するいくつかのアイテムを含む UIToolbar があります。
ここで、デバイスを回転させるときに、viewController を回転させたくありませんが、UIImageViews だけを回転させたいと考えています。つまり、下部のツールバーは左 (または右) になりますが、imageViews は正しく回転します。
そこで、メソッドを使用して
- (BOOL)shouldAutoRotate {
return YES;
}
と組み合わせ
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
と
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
// rotate the image views here
}
サポートされているインターフェイスの向きは 1 つだけなので、デバイスの回転は実行されません ( UIInterfaceOrientationMaskPortrait
)。しかし、メソッドでサポートされる別のインターフェイスの向きを追加するとsupportedInterfaceOrientations
、View Controller も回転します。
向きが 1 つしかサポートされていない場合でも、View Controller の回転を検出するにはどうすればよいですか? または、デバイスの向きの変化に基づいて UIViews を回転させる別の可能性はありますか?
助けてくれてありがとう!