Created
June 22, 2012 23:42
-
-
Save brentsimmons/2975795 to your computer and use it in GitHub Desktop.
Category method for UIResponder to perform a selector via responder chain
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 UIResponder (RSCore) | |
- (BOOL)rs_performSelectorViaResponderChain:(SEL)aSelector withObject:(id)anObject { | |
UIResponder *nomad = self; | |
while (nomad != nil) { | |
if ([nomad respondsToSelector:aSelector]) { | |
[nomad performSelector:aSelector withObject:anObject]; | |
return YES; | |
} | |
nomad = [nomad nextResponder]; | |
} | |
return NO; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment