Created
September 16, 2015 16:59
-
-
Save abbeyjackson/69f07ccd7e0846c5573f to your computer and use it in GitHub Desktop.
NSLog / print out what UI element you tap. For finding what code / method / function belongs to what element. From Aryan Ghassemi in ios-dev slack
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
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
[self addGesture:self.view]; | |
} | |
- (void)addGesture:(UIView *)aView { | |
UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didDetectClick:)]; | |
[aView addGestureRecognizer:gesture]; | |
for (UIView *subView in aView.subviews) { | |
[self addGesture:subView]; | |
} | |
} | |
- (void)didDetectClick:(UITapGestureRecognizer *)tap { | |
NSLog(@"%@", tap.view); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment