iphone – UISwipeGestureRecognizer手势起点

前端之家收集整理的这篇文章主要介绍了iphone – UISwipeGestureRecognizer手势起点前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
是否可以从UISwipeGestureRecognizer获取手势起点.喜欢它的可能性

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

    UITouch * touch = [touches anyObject];
    gestureStartPoint = [touch locationInView:self];
}

解决方法

根据 UISwipeGestureRecognizer documentation你可以:

You may determine the location where a swipe began by calling the UIGestureRecognizer methods locationInView: and locationOfTouch:inView:. The former method gives you the centroid if more than one touch was involved in the gesture; the latter gives the location of a particular touch.

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

猜你在找的Xcode相关文章