I have a UIViewController handling several UIImageViews on the main view. On the bottom is a UIToolbar with a few items to interact with.
Now, when I rotate the device, I don't want the viewController to rotate, but just the UIImageViews. In other words, the toolbar at the bottom would be on the left (or the right), but the imageViews would be rotated correctly.
So, by using the methods
- (BOOL)shouldAutoRotate {
return YES;
}
combined with
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
and
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
// rotate the image views here
}
any rotation on the device will not be executed, because only one interface orientation is supported (UIInterfaceOrientationMaskPortrait
). But when I add another interface orientation to be supported in the supportedInterfaceOrientations
-method, the view controller will rotate too.
How can I detect a rotation for a view controller, even if only one orientation is supported? Or is there another possibility to rotate UIViews based on the changing device orientation?
Thanks for any help!