错误 - 找不到接受提供的参数的' - '的重载

时间:2014-08-07 23:53:18

标签: ios swift

我收到错误说明 could not find an overload for '-' that accepts the supplied arguments

这是我的代码:

    var lastContentOffset = scrollView.contentOffset.y
    if -lastContentOffset > 64 { // *could not find an overload for '-' that accepts the supplied arguments*
        //do something
    }

我做错了什么?

1 个答案:

答案 0 :(得分:1)

将其更改为:

var lastContentOffset = scrollView.contentOffset.y
if (lastContentOffset * -1) > 64 {
    //do something
}