gpt4 book ai didi

swift - 模糊地使用backgroundColor swift

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

我只想在点击并获得 API 响应后简单地更改 UIButton 的背景。
所以我编写了以下代码。

@IBAction func followClick(sender: AnyObject)
{
//calling SOAP API
//Getting response
sender.backgroundColor = UIColor(red: 146/255.0, green: 29/255.0, blue: 29/255.0, alpha: 1.0)
}

但是出现错误

ambiguous use of backgroundColor

请帮助我完成这个简单的步骤。

最佳答案

有点傻……
刚刚替换为以下内容

@IBAction func followClick(sender: UIButton)

连接 IBAction 时忘记将类从 AnyObject 更改为 UIButton。

关于swift - 模糊地使用backgroundColor swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33369969/

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