views:

591

answers:

2

I would like to display an action sheet sliding from just below the very top status bar.

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

The class I'm calling the following code from is a 'UIViewController'

UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Hello" delegate:nil 
          cancelButtonTitle:nil 
          destructiveButtonTitle:nil 
          otherButtonTitles:nil];

UINavigationBar *navBar = self.navigationController.navigationBar;

[sheet showInView:navBar];

I've seen some apps show a sliding out drawer of some sort from where the status bar is.(eg: Twitterrific) How is this done?

+2  A: 

Apple has stated that they simply would like all action sheets to work the same way and slide in from the same direction. Hence there is no advertised way to easily manipulate their animations and such.

Jaanus
What about location though? The action sheet not only animates from the bottom of a view, it seems to always animate from the bottom of the screen.
gerry3
Not always: with a tab bar, it shows from above it, unless you showInView: on the outer window.
chpwn
I thought by using the navigation bar which is placed at the top (and also inherits from UIView), I'd be able to make it slide from the top. But no it doesn't work that way.
Alexi Groove
A: 

Sure it is possible. Not really easy but it is. Do it like this:

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

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

view.transform = CGAffineTransformMakeRotation(M_PI);

Use for example an empty view, which just has the job to present this ActionSheet.

I hope it was understanable.^^

Sandro Meier

Sandro Meier