UISwipeGestureRecognizer手势起点

Rup*_*ert 4 iphone xcode cocoa-touch objective-c uigesturerecognizer

是否可以从UISwipeGestureRecognizer获取手势起点.喜欢它的可能性

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    UITouch * touch = [touches anyObject];
    gestureStartPoint = [touch locationInView:self];
}
Run Code Online (Sandbox Code Playgroud)

Yan*_*nol 7

根据UISwipeGestureRecognizer文档,您可以:

您可以通过调用UIGestureRecognizer方法locationInView:和locationOfTouch:inView:来确定滑动开始的位置.如果手势中涉及多个触摸,前一种方法会为您提供质心; 后者给出了特定触摸的位置.

PS:你真的应该先看看文档,答案是在UISwipeGestureRecognizer的类引用中,应该不难找到.作为开发人员的一部分是能够查找的东西,Apple有优秀的文档,使用它!