2010-08-12 67 views

回答

1

基本上你需要覆盖onTouchesBegan和onTouchesEnded。当它开始时,记录第一个位置,然后在最后比较最后一次触摸和第一次触摸,看它是否更低或更高。

+7

这真的是_not_要做到这一点。由于他使用iOS4,他可以使用为此目的而制作的新的“UIGestureRecognizer”。 Ohmu的答案更适合。 – 2010-09-28 09:19:38

+0

啊。这很有帮助。谢谢。 – 2010-09-29 02:28:10

6

这里有一个新的API:请参考这个帖子here

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];