Change button background color on click - WatchKit

The button background is initially white, with no background. The background needs to change to the following hexadecimal value: # cd9037

@IBOutlet weak var zeroTapped: WKInterfaceButton!
@IBAction func ZeroTapped() {
    zeroTapped.setBackgroundColor(UIColor(red: 205, green: 144, blue: 55,alpha: 1.0 ))
    var time = dispatch_time(DISPATCH_TIME_NOW, TIMEOUT)
    dispatch_after(time, dispatch_get_main_queue(), {
        self.appendValue(0)
    })
}

Does any body tell me why the following doesn't work? Double checked RGI values.

+4
source share
1 answer

Problem resolved: selfnone.

self.zeroTapped.setBackgroundColor(...)
+1
source

Source: https://habr.com/ru/post/1589066/


All Articles