如何在 iPhone 上的顶部导航状态栏下方显示 UIActionSheet
我想显示一个从顶部状态栏正下方滑动的操作表。
当我使用导航栏作为要显示的视图时,工作表仍显示在屏幕底部。我怎样才能显示它从顶部开始呢?
我调用以下代码的类是“UIViewController”,
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Hello" delegate:nil
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
UINavigationBar *navBar = self.navigationController.navigationBar;
[sheet showInView:navBar];
我见过一些应用程序从状态栏所在的位置显示某种滑出抽屉。(例如:Twitterrific)这是如何完成的?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
苹果表示,他们只是希望所有操作表都能以相同的方式工作并从相同的方向滑入。因此,没有广告上的方法可以轻松地操纵它们的动画等。
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.
当然有可能。确实不容易,但确实如此。这样做:
它所呈现的视图(这里称为视图)也应该被转换。还可以:
使用例如一个空视图,它只负责呈现此 ActionSheet。
我希望这是可以理解的。^^
Sandro Meier
Sure it is possible. Not really easy but it is. Do it like this:
The view in which it is presented (here called view) should also be transformed. Do also:
Use for example an empty view, which just has the job to present this ActionSheet.
I hope it was understanable.^^
Sandro Meier