繁体   English   中英

使用未解决的标识符“ orientatiorawValue”

[英]Use of unresolved identifier 'orientatiorawValue'

Swift不断给我上面键入的错误。 这是代码。

static func rotate(orientation:Orientation, clockwise: Bool) -> Orientation {
    var rotated = orientatiorawValue() + (clockwise ? 1 : -1)
    if rotated > Orientation.TwoSeventy.toRaw() {
        rotated = Orientation.Zero.toRaw()
    } else if rotated < 0 {
        rotated = Orientation.TwoSeventy.toRaw()
    }
    return Orientation.fromRaw(rotated)!
}

请非常具体。 提前致谢 :)。

看来您已经从Swift 1.0过渡到1.1语法了一半。 无论您在.toRaw()哪里,都需要切换到.rawValue ,然后.rawValue修复此行:

var rotated = orientation.rawValue + (clockwise ? 1 : -1)

最后,您的退货必须是:

return Orientation(rawValue: rotated)!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM