In my application, there is one view controller that cannot change orientation. Think of it as a game board that needs to be kept in place.
Now I want to place the UIActionSheet, but given the way the user holds the device, I would like to map the sheet to the orientation.
It seems that UIActionSheet, unlike, say, MFComposerViewController, does not get its orientation from the StatusBar, which I rotate based on the orientation, but get the orientation from the main view controller. In other words, the UIActionSheet appears in portrait orientation, regardless of how the device is held.
I tried:
CGAffineTransform t = CGAffineTransformMakeRotation(lastUIAngle);
[actionSheet setTransform:t];
if (UIInterfaceOrientationIsLandscape(lastOrientation))
actionSheet.frame = CGRectMake(0, 0, 480, 320);
else
actionSheet.frame = CGRectMake(0, 0, 320, 480);
actionSheet.center = self.view.center;
And I manage to get the correct orientation, but the resulting action sheet appears on the side of the portrait and is sized as if it were still in portrait orientation. The worksheet frame is calculated based on the number of buttons, etc.
Has anyone been able to get the UIActionSheet to display correctly in the specified orientation?
(I also tried to create a new view that was converted and had the correct size, but the UIActionSheet ignored it. All that remains was to create a new UIViewController that automatically rotates and has a UIActionSheet, which means that my playing field is completely covered by the new view controller.)