在iOS中,为什么超出UIImageView拖动不会结束PanGestureRecognizer?

时间:2015-03-22 13:33:31

标签: ios uiimageview uigesturerecognizer uipangesturerecognizer

我有一个附有PanGestureRecognizer的UIImageView。当我在ImageView外面拖动时,我想将平移视为已结束,但显然GestureRecognizer一直在触发,就像我仍在拖动视图一样。

Pan ended illustration

我猜这与我对视角的误解有关。

什么是正确的方法来了解平底锅何时离开了它附加的UIImageView?

1 个答案:

答案 0 :(得分:1)

OC:

CGPoint p = [recognize locationInView:imageView];
bool out = ![imageView pointInside:p withEvent:nil];

夫特:

var p = recognize.locationInView(self.view);
var out = !self.view.pointInside(point, withEvent: nil);

如果输出是YES。潘离开了imageView。