如何重置UIPanGestureRecognizer?调用“重置”会生成“类型值'UIPanGestureRecognizer'没有成员'重置'”错误

时间:2018-03-21 22:47:54

标签: ios uigesturerecognizer

UIGestureRecognizer的文档引用了reset函数。

但是,在reset() UIPanGestureRecognizer上调用UIGestureRecognizer会生成此错误消息:

  

'UIPanGestureRecognizer'类型的值没有成员'重置'

如何在“已更改”状态期间重置UIPanGestureRecognizer

2 个答案:

答案 0 :(得分:1)

如果UIPanGestureRecognizer被称为recognizer,请按以下步骤重置:

recognizer.setTranslation(CGPoint(x: 0, y: 0), in: recognizer.view!)

答案 1 :(得分:0)

尝试导入UIKit.UIGestureRecognizerSubclass