如何以编程方式触发 uibarbuttonitem 单击事件

编程入门 行业动态 更新时间:2024-10-23 21:28:47
本文介绍了如何以编程方式触发 uibarbuttonitem 单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建了一个 UIActionSheet

UIActionSheet * action = [[UIActionSheet alloc]initWithTitle:@"" delegate:self cancelButtonTitle: @"cancel" destructiveButtonTitle: @"OK" otherButtonTitles: nil]; [action showInView:self.view]; [action release];

在 UIActionSheet 中的取消按钮事件中,我想触发在我看来的 UIBarButtonItem 事件.

On the event of the cancel button in the UIActionSheet I want to fire the event of a UIBarButtonItem, which is in my view.

我的问题是如何在 UIActionSheet 委托方法中触发按钮事件(不触摸按钮)

My question is how can I fire the button event(without touching the button) in the UIActionSheet delegate method

推荐答案

不知道当前栏按钮项目动作的你可以这样调用:

Not knowing the current bar button item action you can invoke it this way:

[barButtonItem.target performSelector:barButtonItem.action]

然而,这会带来未知选择器"编译器警告,但这可能已解决.

This will however bring "unknown selector" compiler warning, but this may be worked around.

更多推荐

如何以编程方式触发 uibarbuttonitem 单击事件

本文发布于:2023-11-07 11:18:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566305.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单击   事件   方式   uibarbuttonitem

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!