Skip to content

Instantly share code, notes, and snippets.

@bryanluby
Last active August 29, 2015 13:55
Show Gist options
  • Save bryanluby/8772880 to your computer and use it in GitHub Desktop.
Save bryanluby/8772880 to your computer and use it in GitHub Desktop.
Inspect the responder chain
// http://stackoverflow.com/a/4242037/1306872
- (void)inspectResponderChainFromSender:(id)sender
{
if ([sender isKindOfClass:[UIResponder class]]) {
NSMutableArray *responderChain = [NSMutableArray array];
[responderChain insertObject:sender atIndex:0];
while ((sender = [sender nextResponder])) {
if ([sender nextResponder]) {
[responderChain insertObject:[sender nextResponder] atIndex:0];
}
}
NSLog(@"Responder Chain:");
for (id obj in [responderChain copy]) {
NSLog(@"%@\n***", obj);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment