A number of others have asked this question, but it's never been answered. The problem seems trivial and yet it hasn't been addressed in Apple's documentation or elsewhere.
I'm presenting my UIActionSheet instance using the showInView
method:
UIActionSheet *myActionSheet = [[UIActionSheet alloc] initWithTitle:@"Test" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Destroy" otherButtonTitles:@"One", @"Two", nil];
[myActionSheet showInView:self.view];
The UIActionSheet is rendered in the center in whichever orientation it is launched, but when I rotate the iPad, it is seen in the top-right
or the bottom-left
(depending on whether the orientation changed to Portrait or Landscape).
This behavior is what one would expect if the Autoresizing Masks were set to UIViewAutoresizingFlexibleBottomMargin
and UIViewAutoresizingFlexibleRightMargin
, which is the default autoresizingMask value for most view elements, so I tried resetting the value by calling the setAutoresizingMask
method on the UIActionSheet instance.
[myActionSheet setAutoresizingMask:UIViewAutoresizingNone];
But neither this nor any other value for the Autoresizing Mask achieves any change whatsoever.
Is there any solution to this problem?
I would prefer not resorting to dismissing the UIActionSheet
on rotation and re-displaying it - that approach seems unnecessary in principle.