Created
December 10, 2012 16:24
-
-
Save C4Code/4251616 to your computer and use it in GitHub Desktop.
3 distinct tap gestures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "C4WorkSpace.h" | |
@implementation C4WorkSpace | |
-(void)setup { | |
UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(one)]; | |
UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(two)]; | |
tap2.numberOfTapsRequired = 2; | |
UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(three)]; | |
tap3.numberOfTapsRequired = 3; | |
[tap1 requireGestureRecognizerToFail:tap2]; | |
[tap1 requireGestureRecognizerToFail:tap3]; | |
[tap2 requireGestureRecognizerToFail:tap3]; | |
[self.canvas addGestureRecognizer:tap1]; | |
[self.canvas addGestureRecognizer:tap2]; | |
[self.canvas addGestureRecognizer:tap3]; | |
} | |
-(void)one { | |
C4Log(@"1"); | |
} | |
-(void)two { | |
C4Log(@"2"); | |
} | |
-(void)three { | |
C4Log(@"3"); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment