我正在尝试在点击发生时更改故事板中WKInterfaceButton
的背景图片。此外,在调用setBackgroundImage
更改图片时,appendValue(1)
无效。
class keyPadInterfaceController : WKInterfaceController{
@IBOutlet weak var OneClicked: WKInterfaceButton!
let whiteImage = UIImage(named:"keybutton1.png")
let goldImage = UIImage(named:"keybutton2.png")
@IBAction func OneTapped(sender:AnyObject) {
OneClicked.setBackgroundImage(goldImage)
appendValue(1)
}
}
答案 0 :(得分:1)
使用setBackgroundImage
you must pass them from the users iPhone first访问图片。
或者,您可以使用setBackgroundImageNamed
。因此,WatchKit checks your WatchKit app bundle first, followed by the device-side cache。
OneClicked.setBackgroundImageNamed("keybutton2.png")