Created
June 20, 2014 15:16
-
-
Save jbrennan/36634a7a1cc15b6b4a7d to your computer and use it in GitHub Desktop.
Gesture initializer
This file contains 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
@implementation UIGestureRecognizer (ForDummies) | |
+ (instancetype)newWithView:(UIView *)view target:(id)target action:(SEL)action delegate:(id<UIGestureRecognizerDelegate>)delegate | |
{ | |
UIGestureRecognizer *gesture = [[[self class] alloc] initWithTarget:target action:action]; | |
gesture.delegate = delegate; | |
[view addGestureRecognizer:gesture]; | |
view.userInteractionEnabled = YES; | |
return gesture; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment