gpt4 book ai didi

swift - 使 NSButton 半透明

转载 作者:行者123 更新时间:2023-11-28 06:20:35 27 4
gpt4 key购买 nike

我在 NSVisualEffectView 上有 2 个 NSButton。第一个按钮图像是系统 NSEnterFullScreenTemplate 图像。第一个按钮上的图像是半透明的。

在第二个按钮上,我有一个导入到 Assets.xcassets 中的图像。在第二个按钮上,图像不是半透明的(它保持白色)。

如何让这张图片也变成半透明的?

最佳答案

通过在 NSImage 上使用 template 设置:

button.image.isTemplate = true

关于swift - 使 NSButton 半透明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43696064/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com