来自NSButton的弹出菜单实现 [英] Popup menu implementation from NSButton

查看:162
本文介绍了来自NSButton的弹出菜单实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该怎么办呢?

我在想... ...

I was thinking about...

[NSMenu popUpContextMenu:menu withEvent:event forView:(NSButton *)sender];


推荐答案

Yup。

按钮动作调用

[NSMenu popUpContextMenu:menu withEvent:event forView:(NSButton *)sender];

其中
菜单 - 要显示的菜单
发送者 - 您单击的按钮。
事件 - 您可以创建一个新事件,并在创建时指定要显示弹出菜单的位置。

where menu - menu you want to show sender - button you clicked. event - you can create a new event and while creating specify the location as to where you want the popup menu to be shown.

这篇关于来自NSButton的弹出菜单实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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