Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIActionSheet showFromRect Autorotation

Tags:

ios

ios5

I'm showing a UIActionSheet like this:

-(void)accessoryPressed:(id)sender{
    //Omitted unnecessary objects

    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:titleString delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:@"Upload", nil];
    //actionSheet.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
    actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
    actionSheet.tag = ((UIButton*)sender).tag;
    [actionSheet showFromRect:[(UIButton*)sender frame] inView:[(UIButton*)sender superview] animated:YES];
}

Where the sender object is a UIButton embedded in a UITableViewCell's accessory view.

The problem is when the iPad is rotated the actionsheet is not resizing (I don't expect it to actually RESIZE but I want it to be in the correct X,Y) I tried setting the AutoResizingMask to FlexibleLeft and FlexibleTop but it doesn't seem to change.

Does anyone have any idea on how to get the actionSheet to point to the accessoryView after auto-rotation?

Here is what it looks like:

Before Rotation- Before Rotation

After Rotation - enter image description here

like image 712
mkral Avatar asked Dec 04 '12 19:12

mkral


1 Answers

It's a shame UIKit doesn't properly handle this for us. In my own app I handle this by implementing the didRotateFromInterfaceOrientation: method in my view controller and reshow any popover again using the updated frame of the view.

like image 196
rmaddy Avatar answered Sep 17 '22 07:09

rmaddy