如何实现窗口指向状态栏项的UI效果?
我在一些应用程序上看到过这样做:
任何人都可以建议如何执行此操作的起点?我已经用 Interface builder 和 Cocoa 做了一些工作,但没有这么花哨的。要求是能够在特定菜单栏图标下按需显示窗口,并让用户能够与其交互(按钮和文本字段)。不要求一个完整的解决方案(除非存在),只是朝着正确的方向友好地推动......
I've seen this done on a few apps:
Can anyone suggest a starting point on how to do this? I've done some work with the Interface builder and Cocoa, but nothing this fancy. The requirements are to be able to display a window on demand under a particular menubar icon, and have the user be able to interact with it (buttons and text fields). Not asking for a full blown solution (unless one exists), just a friendly push in the right direction...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从状态栏中获取图标矩形,然后根据该矩形显示您的窗口。您的示例显示了一个箭头(来自 png 背景图像),然后他们将箭头对齐到状态栏中图标矩形的中心。
Get the icons rect from the status bar, then present your window based on that rect. Your example shows an arrow (from a png background image), then they aligned the arrow to be the center of the icons rect in the status bar.
我偶然发现了这一点: http://mattgemmell.com/2008 /03/04/using-maattachedwindow-with-an-nsstatusitem/
Matt Gemmell 为这些类型的窗口创建了一个非常好的类
MAAttachedWindow
I stumbled upon this: http://mattgemmell.com/2008/03/04/using-maattachedwindow-with-an-nsstatusitem/
Matt Gemmell made a very nice class for these kinds of windows
MAAttachedWindow