How to display UIActionSheet just below the top navigation status bar on iPhone

I would like to display a list of actions shifted from just above the very top status bar.

When I use the navigationBar as the view to display, the sheet is still displayed at the bottom of the screen. How can I show it coming from the top instead?

The class I call the following code is "UIViewController"

UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Hello" delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; UINavigationBar *navBar = self.navigationController.navigationBar; [sheet showInView:navBar]; 

I saw some applications showing some kind of sliding box where the status bar is from (for example: Twitterrific). How it's done?

+6
iphone uinavigationcontroller uinavigationbar uiactionsheet
source share
2 answers

Apple said they just wanted all action bars to work the same and slide in the same direction. Therefore, there is no advertised way to easily manipulate their animations, etc.

+4
source share

Of course it is possible. Not very easy, but true. Do it like this:

 UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle...]; sheet.transform = CGAffineTransformmakeRotation(M_PI); [sheet showInView:view]; 

The view in which it is presented (called view here) must also be transformed. Do also:

 view.transform = CGAffineTransformMakeRotation(M_PI); 

Use, for example, an empty view that simply has a job to represent this ActionSheet.

I hope this was not possible. ^^

Sandro Meyer

0
source share

All Articles