我正在处理iWatch应用程序,我收到以下错误:
'WKInterfaceLabel'没有名为'text'的成员
出口:
@IBOutlet var numField: WKInterfaceLabel!
Run Code Online (Sandbox Code Playgroud)
导致错误的相关代码块:
func updateDisplay() {
// If the value is an integer, don't show a decimal point
var iAcc = Int(accumulator)
if accumulator - Double(iAcc) == 0 {
numField.text = "\(iAcc)"
} else {
numField.text = "\(accumulator)"
}
Run Code Online (Sandbox Code Playgroud)
特别:
numField.text = "\(iAcc)"
Run Code Online (Sandbox Code Playgroud)
和
numField.text = "\(accumulator)"
Run Code Online (Sandbox Code Playgroud)