在iPad上使用UIActionSheet [英] Using UIActionSheet on iPad

查看:123
本文介绍了在iPad上使用UIActionSheet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple的UIActionSheet文档让我感到困惑。首先,在iPad人机界面指南中,它说:

Apple's documentation for the UIActionSheet is causing me confusion. First off, in the iPad Human Interface Guidelines, it says :


要了解有关在代码中使用操作表的更多信息,请参阅使用在iPad编程指南中显示内容的弹出窗口。

To learn more about using an action sheet in your code, see "Using Popovers to Display Content" in iPad Programming Guide.

但是在使用弹出窗口显示内容部分中,它没有提起动作表!我在这里遗漏了什么吗?

But then in the "Using Popovers to Display Content" section, it doesn't mention Action Sheets at all! Am I missing something here?

http://developer.apple.com/library/ios/#documentation/General/Conceptual/iPadHIG/UIElements/UIElements.html#/ / apple_ref / doc / uid / TP40009446-CH6-SW9

我的主要问题是:在iPad上,UIPopoverController和a之间有什么区别UIActionSheet?如果UIActionSheet自动出现在UIPopoverController中,是否有任何理由使用UIActionSheet?我看到它的委托和按钮的自动创建如何产生更少的代码行,但是从可用性POV来看,是否存在差异?

My main question is this: on the iPad, what is the difference between a UIPopoverController and a UIActionSheet? If a UIActionSheet automatically presents itself inside a UIPopoverController, is there any reason to use UIActionSheet at all? I see how its delegate and automatic creation of buttons makes for fewer lines of code, but from a usability POV, is there a difference?

另外,用动画显示我的actionSheet根本不工作。它的外观和行为与没有动画的动作表格完全相同(这与我刚刚使用UIPopoverController并且根本没有动作片段完全相同)。这是我的代码:

Also, displaying my actionSheet with animation is not working at all. It looks and acts exactly like an actionSheet presented without animation (which is exactly the same as if I were just using a UIPopoverController and no actionSheet at all). Here's my code:

UIActionSheet *action = [[UIActionSheet alloc] initWithTitle:@"An unsaved property already exists. You must assign a name to this property before creating a new property. Would you like to:"
    delegate:self
    cancelButtonTitle:nil
    destructiveButtonTitle:@"Overwrite"
    otherButtonTitles:@"Open unsaved property", nil];

[action showFromRect:CGRectMake(0, 0, 200, 200) inView:self.mainSplitViewController.view animated:NO];

我如何获得一个看起来像Apple文档中的示例动画actionSheet的动作表(来自地图应用程序) ,你在哪里向联系人添加位置??

How would I get an actionSheet that looks like the sample animated actionSheet in Apple's documentation (from the maps application, where you add a location to a contact)?

我可能最终会使用此警报而不是弹出框或动作表,但它仍然有用理解这一点。

I may just end up using an alert for this rather than a popover or an actionSheet, but it would still be useful to understand this.

谢谢!

推荐答案

首先, UIActionSheet UIPopoverController UIPopoverController 之前不存在iPhone,因此它对向后兼容性和通用应用程序很有用。

First of all, UIActionSheet existed before UIPopoverController and UIPopoverController isn't available on iPhone, so it's useful for backwards compatibility and universal apps.

此外, UIActionSheet 不一定在弹出窗口,特别是,如果你从一个已经在弹出框内的 UIBarButtonItem UIToolbar 中显示它。然后以类似于iPhone的方式呈现它(从视图控制器的底部滑入)。根据HIG,你不能同时出现多个弹出窗口(我曾经有一个应用程序被拒绝),所以如果视图控制器可能在弹出窗口内(如在标准的拆分视图应用程序中),你可以想要使用行动表,如果可能的话。当然,在很多情况下你不能用操作表替换弹出窗口,因为操作表只显示按钮列表和标题,而弹出框可以显示任何视图控制器。

Also, a UIActionSheet isn't necessarily presented in a popover, specifically, if you show it from a UIBarButtonItem or UIToolbar that is already inside a popover. It is then presented in a similar fashion as on the iPhone (sliding in from the bottom of the view controller). According to the HIG, you must not present multiple popovers at the same time (I once had an app rejected for that), so in cases where a view controller may be inside a popover (like in a standard split view app), you may want to use action sheets, if possible. Of course there are a lot of cases where you can't replace a popover with an action sheet, because an action sheet only shows a list of buttons and a title, whereas a popover can display any view controller.

我认为动画参数仅在经典(如在iPhone上)呈现操作表时才有效。

I think that the animated parameter only has an effect when an action sheet is presented in the "classic" (as on iPhone) way.

这篇关于在iPad上使用UIActionSheet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆