简体   繁体   English

如何在iPhone的顶部导航状态栏下方显示UIActionSheet

[英]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. 当我使用navigationBar作为要显示的视图时,工作表仍然显示在屏幕的底部。 How can I show it originating from the top instead? 我怎样才能显示它来自顶部呢?

The class I'm calling the following code from is a 'UIViewController' 我正在调用以下代码的类是'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? 我已经看到一些应用程序显示了状态栏所在的某种抽屉式抽屉。(例如:Twitterrific)这是怎么做到的?

Apple has stated that they simply would like all action sheets to work the same way and slide in from the same direction. Apple已声明他们只是希望所有操作表以相同的方式工作并从同一方向滑入。 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. 例如,使用一个空视图,它只有作业来呈现此ActionSheet。

I hope it was understanable.^^ 我希望这是无法解决的。^^

Sandro Meier 桑德罗梅尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM