macos – 在黑色和蓝色之间切换NSToolbarItem

macos – 在黑色和蓝色之间切换NSToolbarItem,第1张

概述我想制作一个带有自定义图像的NSToolbarItem,它可以在黑色和蓝色之间切换,就像 Xcode 5主窗口右上角的图标一样. Peter Hosey suggested in this answer that it was as simple as setting the image to be a template,但我还没有发现是这样的.我将其设置为模板图像,这会导致它正确渲染深灰色渐变, 我想制作一个带有自定义图像的NSToolbarItem,它可以在黑色和蓝色之间切换,就像 Xcode 5主窗口右上角的图标一样.

Peter Hosey suggested in this answer that it was as simple as setting the image to be a template,但我还没有发现是这样的.我将其设置为模板图像,这会导致它正确渲染深灰色渐变,但切换时不会呈现蓝色.

I uploaded a very simple example of what I’ve done,here.如果有人能告诉我如何改变它以点亮蓝色的NSToolbarItem,就像Xcode那样,那么我非常感激.

解决方法 除了使用NSTexturedRoundedBezelStyle样式提供NSbutton对象之外,您通常拥有所需的一切,并且您已将其与图像相关联.

↳modified example project here

⌘OS X Human Interface Guidelines | Window-Frame Controls

总结

以上是内存溢出为你收集整理的macos – 在黑色和蓝色之间切换NSToolbarItem全部内容,希望文章能够帮你解决macos – 在黑色和蓝色之间切换NSToolbarItem所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1022798.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存