gpt4 book ai didi

swift - 更改 NSButton 的图像

转载 作者:行者123 更新时间:2023-11-30 10:33:30 24 4
gpt4 key购买 nike

我试图更改按钮的背景图像,但它给了我这个错误:

Value of type '(NSButton) -> ()' has no member 'image'

likeButton.image = NSImage(named: NSImage.Name("like"))

最佳答案

您可以使用setBackgroundImage函数来更改它。

例如

likeButton.setBackgroundImage(anImage, for: UIControl.State.normal)

关于swift - 更改 NSButton 的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58581466/

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