如何在屏幕上获取NSStatusItem的位置

时间:2015-04-30 17:28:19

标签: objective-c cocoa frame nswindow nsstatusitem

我在菜单栏上有一个带有NSStatusItem的应用程序。现在我想使用快捷键来调用NSWindow,它应该显示在NSStatusItem下面。点击鼠标,我只需获取状态项的位置:

CGRect eventFrame = [[[NSApp currentEvent] window] frame];

但是如果我使用快捷方式调用窗口,我不知道如何获得这个位置。 NSStatusItem具有自定义视图。

类似的问题在这里How to get the on-screen location of an NSStatusItem,但没有人能给出解决方案。

0 个答案:

没有答案
相关问题