【问题标题】:ambiguous use of backgroundColor swiftbackgroundColor swift的模糊使用
【发布时间】:2015-10-27 13:57:03
【问题描述】:

我只想在单击并获得 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)
}

但是得到错误

背景颜色的模糊使用

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

【问题讨论】:

    标签: swift uibutton ambiguous


    【解决方案1】:

    有点笨...
    只是替换为以下

    @IBAction func followClick(sender: UIButton)
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-09
      • 2016-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多