-6

我有 16 个按钮。我想在单击按钮时更改按钮的背景颜色。

这是我的代码:

@IBOutlet var buttons: [UIButton]!

@IBAction func button_Taped(_ sender: UIButton) {  

    }
}

单击按钮更改按钮的背景颜色时如何更改

4

1 回答 1

0
@IBOutlet var buttons: [UIButton]!

@IBAction func button_Taped(_ sender: UIButton) {  
sender.backgroundColor = // your desired color
    }
}
于 2019-10-26T20:26:53.000 回答