4

Button background is initially white with no background. Need the background to change to the following hex 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)
    })
}

Any body suggest why the following isn't working? Double checked RGI values.

PS1690
  • 85
  • 8
  • try testing another RGB color ..does it show? – LC 웃 May 20 '15 at 18:55
  • Is the view active when you call the function to change the color? – John May 20 '15 at 19:42
  • I tried the following color: zeroTapped.setBackgroundColor(UIColor(red: 1.0, green: 1.0, blue: 1.0,alpha: 1.0 )). Still doesnt work – PS1690 May 20 '15 at 19:54
  • @vomako the view is active because when i try to change an image instead of color self.zeroTapped.setBackgroundImageNamed("keybutton1.png") it works – PS1690 May 20 '15 at 19:56
  • Ok I did self.zeroTapped.setBackgroundColor(...). This worked. – PS1690 May 20 '15 at 20:00

1 Answers1

2

The problem has been resolved: self was missing.

self.zeroTapped.setBackgroundColor(...)
John
  • 8,468
  • 5
  • 36
  • 61