Search code examples
iosobjective-cipaduiactionsheet

Reposition UIActionSheet on iPad


I have a UIActionSheet which appears as a UIPopoverController on the iPad. I am trying to show it from a UIButton by using:

[self.exampleActionSheet showFromRect:self.exampleButton.frame inView:self.view animated:YES];

What I am trying to do now is to reposition this UIActionSheet on orientation change. But when I use the above code to reposition after the screen has rotated, it doesn't do so. Can anyone tell me how to do this properly?


Solution

  • A better workflow would be:

    1. Dismiss actionsheet when a rotation occurs
    2. Calculate the new rectangle where it should be presented from
    3. Present a new actionsheet from the new rectangle