The question now is: add a UISwipeGestureRecognizer gesture, hoping to achieve swipe about imageview (Of course, there may be self.view, this is not the point) the automatic processing of a button corresponding algorithm.
So how to achieve it?
Reply:
The landlord, UISwipeGestureRecognizer you have a custom monitor events in this incident, put your current button tag +1, then call a particular tag algorithm, you can write a separate method algorithm
Reply:
UISwipeGestureRecognizer * swipeGestureRecognizer = nil;
swipeGestureRecognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget: self action: @ selector (swipe :)] autorelease];
[SwipeGestureRecognizer setDirection: UISwipeGestureRecognizerDirectionUp];
[Self.view addGestureRecognizer: swipeGestureRecognizer];
swipeGestureRecognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget: self action: @ selector (swipe :)] autorelease];
[SwipeGestureRecognizer setDirection: UISwipeGestureRecognizerDirectionDown];
[Self.view addGestureRecognizer: swipeGestureRecognizer];
swipeGestureRecognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget: self action: @ selector (swipe :)] autorelease];
[SwipeGestureRecognizer setDirection: UISwipeGestureRecognizerDirectionLeft];
[Self.view addGestureRecognizer: swipeGestureRecognizer];
swipeGestureRecognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget: self action: @ selector (swipe :)] autorelease];
[SwipeGestureRecognizer setDirection: UISwipeGestureRecognizerDirectionRight];
[Self.view addGestureRecognizer: swipeGestureRecognizer];
- (Void) swipe: (UISwipeGestureRecognizer *) swipeGestureRecognizer
{
switch (swipeGestureRecognizer.direction) {
case UISwipeGestureRecognizerDirectionUp:
NSLog (@ "UISwipeGestureRecognizerDirectionUp");
/ / Your method
break;
case UISwipeGestureRecognizerDirectionDown:
NSLog (@ "UISwipeGestureRecognizerDirectionDown");
/ / Your method
break;
case UISwipeGestureRecognizerDirectionLeft:
NSLog (@ "UISwipeGestureRecognizerDirectionLeft");
/ / Your method
break;
case UISwipeGestureRecognizerDirectionRight:
NSLog (@ "UISwipeGestureRecognizerDirectionRight");
/ / Your method
break;
default:
break;
}
}
Swipe their own methods to achieve it.
Reply:
Although the two did not understand what I mean, but I have to get out, or thank you, end quote ~ ~ ~
No comments:
Post a Comment