我正在为 tvOS 创建一个应用程序。我正在尝试设置 UIButton 的颜色,但不知道如何正确设置。
var buttonA: UIButton(type: .system)
var buttonB: UIButton(type: .system)
...
buttonA.backgroundColor = UIColor.green
buttonB.backgroundColor = UIColor.red
当按钮聚焦时,我对结果感到满意,但当按钮不聚焦时,我得到一个丑陋的结果。绿色按钮有一个缺少其cornerRadius 的彩色层。
如何正确为按钮着色?
最佳答案
buttonA.layer.cornerRadius = 10
关于swift - 如何在 Swift 中为 tvOS 设置 UIButton 类型 : . 系统的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43331003/