[英]Finger Swipe On iPad Screen
How do i implement and code for recognizing swipes across the screen, and also making it so that if it swipes on a uiimageview then things happen, // code, how can i do this?我如何实现和编码以识别屏幕上的滑动,并使其如果它在 uiimageview 上滑动,那么事情就会发生,//代码,我该怎么做? THanks
谢谢
Use UISwipeGestureRecognizer.使用 UISwipeGestureRecognizer。 Something like this to detect a swipe on
imageView
:像这样检测
imageView
上的滑动:
UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(imageSwiped:)];
swipe.direction = UISwipeGestureRecognizerDirectionRight;
[imageView addGestureRecognizer:swipe];
[swipe release];
Then define a method - (void)imageSwiped:(UISwipeGestureRecognizer *)sender
and react to the swipe there.然后定义一个方法
- (void)imageSwiped:(UISwipeGestureRecognizer *)sender
并对那里的滑动做出反应。
I suggest you use a UISwipeGestureRecongizer
for it, unless you have a very specific gesture to recongize.我建议你使用
UISwipeGestureRecongizer
,除非你有一个非常具体的手势来识别。
Try reading out: Event Handling Guide for iOS from Apple.尝试阅读:Apple 的 iOS 事件处理指南。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.