Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gesture initializer
@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
You can’t perform that action at this time.