gpt4 book ai didi

objective-c - iPad 上的 UIActionSheet 未显示取消按钮

转载 作者:太空狗 更新时间:2023-10-30 03:10:07 24 4
gpt4 key购买 nike

我试图在 UIActionSheet 中显示取消按钮,但它没有显示,这是可接受的行为吗?请指教。

UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@"Are you sure you want to clear the cache?"
delegate:self
cancelButtonTitle:@"No"
destructiveButtonTitle:@"Yes"
otherButtonTitles:nil];

[actionSheet showInView:self.view];

[actionSheet release];

最佳答案

iPad 有一些关于操作表及其取消按钮的特殊规则,具体取决于您从何处显示它:

You can present an action sheet from a toolbar, tab bar, button bar item, or from a view. This class takes the starting view and current platform into account when determining how to present the action sheet. For applications running on iPhone and iPod touch devices, the action sheet typically slides up from the bottom of the window that owns the view. For applications running on iPad devices, the action sheet is typically displayed in a popover that is anchored to the starting view in an appropriate way. Taps outside of the popover automatically dismiss the action sheet, as do taps within any custom buttons. You can also dismiss it programmatically.

When presenting an action sheet on an iPad, there are times when you should not include a cancel button. If you are presenting just the action sheet, the system displays the action sheet inside a popover without using an animation. Because taps outside the popover dismiss the action sheet without selecting an item, this results in a default way to cancel the sheet. Including a cancel button would therefore only cause confusion. However, if you have an existing popover and are displaying an action sheet on top of other content using an animation, a cancel button is still appropriate. For more information see iPad Human Interface Guidelines.

这是一个包含更多解释的链接:http://crazyviraj.blogspot.com/2010/05/showing-cancel-button-in.html

关于objective-c - iPad 上的 UIActionSheet 未显示取消按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6028921/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com