I want to rotate my UISlider in iPhone landscape layouts and am using this code to to it.
self.customSlider.transform = CGAffineTransformMakeRotation(M_PI/2);
However, I want to use it in -(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
so that it rotates appropriately based on size classes.
I have the following code where I put other rotation code
-(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;
}
}
I want to make sure that the UISlider is in the proper orientation in each orientation with the left edge of the slider on top in landscape and the right on the bottom. I need to check the rotation to make sure that slider is in the right position regardless of how the user rotates from portrait to landscape left or right. How can I do this?
EDIT: I am using GPUImage and the preview view uses an orientation left/right for that view, so I need to find an implementation that allows me to keep that while also allowing for general size class customization.