如何在苹果手表上显示标签?

时间:2016-09-11 02:49:24

标签: watchkit watch-os watch-os-3 wkinterfacelabel

Xcode 8.0

我尝试为 watchOS 编写我的第一个应用。我只想在按下按钮时显示一个音符。这是我到目前为止所得到的:

import WatchKit
import Foundation


class InterfaceController: WKInterfaceController {

@IBOutlet var myLabel: WKInterfaceLabel!


@IBAction func getNote(){


    print("button pushed")

    myLabel.text = "here is your note"

}

我已经尝试了不同的方法,但实际上仍然坚持在显示屏上显示注释。最新的错误显示“类型的值”WKInterfaceLabel“没有成员”text“”

有什么想法吗?非常感谢提前!

1 个答案:

答案 0 :(得分:0)

您需要使用setText代替text

myLabel.setText("here is your note")

这里是reference

相关问题