UIActionSheet 取消按钮不关闭操作表

发布于 2024-12-21 13:23:13 字数 357 浏览 1 评论 0原文

我有一个 UIActionSheet 并且指定了取消按钮,但是点击时它不会关闭?

UIActionSheet *actionSheet = [[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Target Complete" otherButtonTitles:nil] autorelease]; 
[actionSheet showInView:self.view];

根据文档,我不需要任何代码,即使当我尝试实现 didCancel 委托方法时,它也从未被调用?

I have an UIActionSheet and I am specifying the cancel button however it does not dismiss when its tapped?

UIActionSheet *actionSheet = [[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Target Complete" otherButtonTitles:nil] autorelease]; 
[actionSheet showInView:self.view];

According to the documentation I don't need any code and even when I try and implement the didCancel delegate method its never called?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

煮酒 2024-12-28 13:23:13

试试这个

[actionSheet showInView:[self.view window]];

UIActionSheet取消按钮奇怪的行为

Try this

[actionSheet showInView:[self.view window]];

UIActionSheet cancel button strange behaviour

时光沙漏 2024-12-28 13:23:13

这可以解决问题

[actionSheet showInView:[self.view window]];

而不是

[actionSheet showInView:self.view];

This Will do the trick

[actionSheet showInView:[self.view window]];

instead of

[actionSheet showInView:self.view];
葬花如无物 2024-12-28 13:23:13

使用

[actionSheet showFromTabBar:[[self tabBarController] tabBar]];

而不是

[actionSheet showInView:self.view];

这个工作正常..:-)

use

[actionSheet showFromTabBar:[[self tabBarController] tabBar]];

instead of

[actionSheet showInView:self.view];

this is working fine.. :-)

对岸观火 2024-12-28 13:23:13

您需要从 iPhone 上的任务栏或工具栏进行显示,因为如果您使用在视图中显示,它会剪辑某些控件。

You need to display from a taskbar or a toolbar on iPhone as it clips some of the controls if you use display in view.

﹂绝世的画 2024-12-28 13:23:13

编写简单的代码,

 actionSheet.actionSheetStyle = UIActionSheetStyleDefault;

效果很好

write simplite code

 actionSheet.actionSheetStyle = UIActionSheetStyleDefault;

this work fine

笑红尘 2024-12-28 13:23:13

我在这里找到了答案。

https://stackoverflow.com/a/1530259/1803218

[menu sendSubviewToBack:pickerView];

I found the answer here.

https://stackoverflow.com/a/1530259/1803218

[menu sendSubviewToBack:pickerView];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文