在OS X应用程序上,当鼠标悬停在NSMenuItem上时,显示NSPopover的技术是什么(例如聚光灯下)。
非常感谢!!! Christopjhe
答案 0 :(得分:5)
我知道已经有一段时间了,但如果你还没有找到解决方案:
将您的课程注册为NSMenuDelegate
到包含NSMenuItem
的菜单,并实施
- (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item;
然后在调用此方法时显示弹出窗口。
答案 1 :(得分:-1)
你能在问题中显示你的代码吗?它会让你更容易帮助你。但是不知道你的代码是什么样的,这可能适合你:
将此添加到statusItem
self.statusItem.action = @selector(clickStatusBar:);
添加与此类似的方法以显示弹出窗口
- (void)clickStatusBar:(id)sender {
[[self popover] showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge];
}