gpt4 book ai didi

ios - 点击更改 WKInterfaceButton 背景图像

转载 作者:行者123 更新时间:2023-11-28 07:06:34 27 4
gpt4 key购买 nike

我正在尝试在发生点击时更改 Storyboard 中 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)
}
}

最佳答案

使用 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")

关于ios - 点击更改 WKInterfaceButton 背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30337581/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com