什么是Swift相当于UIGestureRecognizerStateEnded?

时间:2014-09-13 20:21:53

标签: ios objective-c swift uipangesturerecognizer

我正试图检测平移手势何时结束。在Objective-C下,我会做类似以下的事情:

- (void)panGesture:(UIPanGestureRecognizer *)gesture {
    if (gesture.state == UIGestureRecognizerStateEnded) {
        ...
    }
}

在我的Swift项目中,它无法识别UIGestureRecognizerStateEnded ...也许我只需要导入不同的东西(?)

1 个答案:

答案 0 :(得分:8)

等价物只是

gesture.state == .Ended

或者如果你喜欢

gesture.state == UIGestureRecognizerState.Ended