Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 更改iOutletCollection中UIButton的背景色_Ios_Swift_Background Color_Iboutlet_Iboutletcollection - Fatal编程技术网

Ios 更改iOutletCollection中UIButton的背景色

Ios 更改iOutletCollection中UIButton的背景色,ios,swift,background-color,iboutlet,iboutletcollection,Ios,Swift,Background Color,Iboutlet,Iboutletcollection,我有16个按钮。我想改变按钮的背景色,当按钮被点击时 这是我的代码: @IBOutlet var buttons: [UIButton]! @IBAction func button_Taped(_ sender: UIButton) { } } 单击“更改发件人背景色”按钮时,我如何更改?请不要仅将代码作为答案发布,还要说明代码的作用以及如何解决问题。带有解释的答案通常质量更高,更容易吸引选票。 @IBOutlet var buttons: [UIButton]! @IBA

我有16个按钮。我想改变按钮的背景色,当按钮被点击时

这是我的代码:

@IBOutlet var buttons: [UIButton]!

@IBAction func button_Taped(_ sender: UIButton) {  

    }
}

单击“更改发件人背景色”按钮时,我如何更改?请不要仅将代码作为答案发布,还要说明代码的作用以及如何解决问题。带有解释的答案通常质量更高,更容易吸引选票。
@IBOutlet var buttons: [UIButton]!

@IBAction func button_Taped(_ sender: UIButton) {  
sender.backgroundColor = // your desired color
    }
}