Swift'WKInterfaceLabel'没有名为'text'的成员

亚沙尔

我正在使用iWatch应用程序,但出现以下错误:

“ WKInterfaceLabel”没有名为“ text”的成员

出口:

@IBOutlet var numField: WKInterfaceLabel!

导致错误的相关代码块:

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)"
    }

特别:

numField.text = "\(iAcc)"

numField.text = "\(accumulator)"

我已经尝试其他答案中建议的可选方法,但仍然遇到问题。

顽皮的

来自班级参考

没有文本属性。设置文本的方法是调用setText方法:

numField.setText("\(Acc)")

要么

numField.setText("\(accumulator"))

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Swift'没有名为的成员'

Swift ViewController没有名为的成员

Swift-桥接头失败。“ *”没有名为“ *”的成员

Swift-'String'没有名为'isEqualToString'的成员

'[细绳]?' 在Swift中没有名为“ count”的成员

Swift 1.2 [AnyObject]没有名为'objectForKey'的成员

Swift NSURLConnection没有名为start的成员

Swift'String.Type'没有名为'stringWithContentsOfFile'的成员

Swift:'((NSObject,AnyObject)'没有名为'subscript'的成员

swift uiview没有名为center的成员

SWIFT字符串?没有名为“ element”的成员

“ NSURLRequest?” 没有名为“ URL”的成员-Swift

'UICollectionViewCell'没有名为'image'的成员[Swift]

模块“Swift”没有名为“Task”的成员

Swift数组“对象”没有名为下标的成员

Swift SpriteKit:“ MCTFruit没有名为append的成员吗?

没有名为的成员

Swift代码错误:String.Type没有名为'stringWithContentOfURL'的成员

$ T4没有名为Generator ERROR swift的成员

将变量声明为可选值时,Swift枚举没有名为“ rawValue”的成员

Swift 2.0'Element.Protocol'没有名为'Hour'的成员,NSCalendar.components

为什么AVPlayerView在Swift中没有名为“ player”的成员

Swift iOS8.1选择器没有名为'convertFromStringLiteral'的成员

6.0.1和表更改“ UILabel?没有名为'text'的成员

“ UINavigationController?” 没有名为“ popToRootViewControllerAnimated”的成员

[AnyObject]?没有名为“下标”的成员

NSURLResponse没有名为allHeaderFields的成员

UIButton没有名为“ target”的成员

UIView没有名为'delegate的成员