UISlider を iPhone の横向きレイアウトで回転させたいのですが、このコードを使用しています。
self.customSlider.transform = CGAffineTransformMakeRotation(M_PI/2);
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
ただし、サイズ クラスに基づいて適切に回転するように使用したいと考えています。
私は他のローテーションコードを置く次のコードを持っています
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft) {
self.stillCamera.outputImageOrientation = UIInterfaceOrientationLandscapeRight;
}
if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight) {
self.stillCamera.outputImageOrientation = UIInterfaceOrientationLandscapeLeft;
}
if ([UIDevice currentDevice].orientation == UIDeviceOrientationPortrait) {
self.stillCamera.outputImageOrientation = UIDeviceOrientationPortrait;
}
}
UISlider が各方向で適切な方向にあることを確認したいのですが、スライダーの左端が横向きで、右端が下になります。ユーザーが縦向きから横向きに左または右に回転する方法に関係なく、スライダーが正しい位置にあることを確認するために、回転を確認する必要があります。これどうやってするの?
編集: 私は GPUImage を使用しており、プレビュー ビューはそのビューの左/右方向を使用するため、一般的なサイズ クラスのカスタマイズを可能にしながら、それを維持できる実装を見つける必要があります。