开发者

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

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?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜