0
这是我第一天学习如何编写代码。我想使用watchOS 2制作一个简单的WatchKit应用程序。不知道为什么这个基本的watchOS 2应用程序不工作
我得到了Hello World应用程序启动并运行,现在当我尝试使用菜单按下触发标签更改时,代码不会编译,以下错误:
WKInterfaceLabel doesn't have a member called set.
你可以看到详细图像here。
Swift代码:
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
@IBOutlet var label: WKInterfaceLabel!
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
// Configure interface objects here.
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
@IBAction func CookBabyCook() {
label.set("Cooked!")
}
}
非常感谢奥利弗!这解决了,非常感谢:) –