2

如何在新的 iPhone SDK 中添加滑动手势?我正在尝试检测 UIImageView 上的滑动手势?向上滑动和向下滑动?

4

4 回答 4

6

为此有一个新的 API:请参阅此处的这篇文章。

于 2010-09-28T09:04:30.437 回答
4

在 iOS 4.0 中处理手势有更简单的方法,请参阅:

http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizers/GestureRecognizers.html

于 2011-01-26T02:26:20.753 回答
1

请从此链接下载滑动手势代码:

https://github.com/brow/leaves/downloads

UISwipeGestureRecognizer *settingbtnpress =
[[UISwipeGestureRecognizer alloc]
 initWithTarget:self
 action:@selector(MethodName)];
settingbtnpress.delegate=self;
settingbtnpress.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:settingbtnpress];
[settingbtnpress release];
于 2012-07-26T10:19:40.823 回答
1

基本上你需要重写 onTouchesBegan 和 onTouchesEnded。当它开始时,记录第一个位置,然后在最后将最后一次触摸与第一次触摸进行比较,看它是更低还是更高。

于 2010-08-12T03:14:45.650 回答