我已将操作作为匿名方法添加到我的手势识别器
UITapGestureRecognizer tapGesture = new UITapGestureRecognizer ();
tapGesture.AddTarget (() => HandleTap (tapGesture));
如何删除目标?需要 UIGestureRecognizer.Token
。
最佳答案
RTFM这里是正确的:
An instance of this class is returned when you invoke the UIGestureRecognizer's UIGestureRecognizer.AddTarget method. The AddTarget returns this token as a mechanism for later unsubscribing this particular action from the recognizer using the UIGestureRecognizer.RemoveTarget method.
UIGestureRecognizer.Token token = tapGesture.AddTarget (() => HandleTap (tapGesture));
if (token != null) {
tapGesture.RemoveTarget (token);
}
关于ios - 从 UITapGestureRecognizer 中删除目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32115108/