我如何用 Cocoa 创建一个透明且非矩形的 NSWindow?
我想为我的 Cocoa 应用程序创建一个 Windows 风格的错误弹出窗口,如下所示
有没有教程如何执行此操作?或者有人可以至少给我一些我需要检查的 API 函数的名称吗?
I want to create a windows style error popup for my Cocoa application like this one
Is there any tutorial how to do this? Or can somebody give me at least the names of a few API functions that i need to check out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
苹果有一个例子: 圆形透明窗口< /a>
Apple has an example: Round Transparent Window
看一下 MAAttachedWindow。您可以配置其背景和边框以匹配。
Take a look at MAAttachedWindow. You can configure its background and border to match.
从 10.7 开始,您可以使用 NSPopover 来完成此操作。
我不确定是否可以将其设置为透明,但默认外观与弹出窗口在 Mac 上的预期外观一致。
As of 10.7, you can do this with NSPopover.
I'm not sure whether you can make one transparent, but the default appearance is consistent with how popovers are expected to look on the Mac.