Skip to content

Instantly share code, notes, and snippets.

@fannheyward
Forked from luosheng/AppDelegate.m
Last active September 18, 2015 07:50
Show Gist options
  • Save fannheyward/6d3da74ba176e8390357 to your computer and use it in GitHub Desktop.
Save fannheyward/6d3da74ba176e8390357 to your computer and use it in GitHub Desktop.
// Include https://github.com/steipete/Aspects in your project
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[UIButton aspect_hookSelector:@selector(touchesEnded:withEvent:) withOptions:AspectPositionAfter usingBlock:^(id<AspectInfo> info) {
UIButton *button = [info instance];
UIView *topMostView = button.window.subviews.firstObject;
[self logSubviews:topMostView];
} error:nil];
return YES;
}
- (void)logSubviews:(UIView *)view {
for (UIView *subview in view.subviews) {
if ([subview isKindOfClass:[UITextField class]]) {
NSLog(@"Text: %@", ((UITextField *)subview).text);
} else {
[self logSubviews:subview];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment