我正试图检测平移手势何时结束。在Objective-C下,我会做类似以下的事情:
- (void)panGesture:(UIPanGestureRecognizer *)gesture {
if (gesture.state == UIGestureRecognizerStateEnded) {
...
}
}
在我的Swift项目中,它无法识别UIGestureRecognizerStateEnded
...也许我只需要导入不同的东西(?)
答案 0 :(得分:8)
等价物只是
gesture.state == .Ended
或者如果你喜欢
gesture.state == UIGestureRecognizerState.Ended