我正在尝试从显示底部边缘识别 UIPanGestureRecognizer,根据我的经验,只需询问与 x 的差异是否离底部边缘太近就可以很容易,但是当我调试时,我得到了很多结果对我没用的 locationInView 手势坐标。
我一直在做测试,当我从底部边缘快速移动手指时,我得到的坐标有超过 50 个不同的点,我怎么知道什么是获得这个结果的最佳方法?
最佳答案
您可以使用UIGestureRecognizerDelegate
。
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
CGPoint location = [touch locationInView:gestureRecognizer];
if(location_is_in_the_area_that_you_want)
return TRUE;
return FALSE;
}
希望这对您有所帮助。干杯!
关于ios - 如何知道 UIPanGestureRecognizer 是否来自一个显示边缘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14807123/