Dynamically call delegate method by name in Objective-C
When you receive messages for example in a chat application, you will probably want to handle them in a delegate.
This code automatically send to the delegate a message named handleCommandName, with the command parameters as message parameter and where CommandName is the command to handle.
For example:
- (void)handleNick:(NSArray *)parameters { ... }
Written by Lorenzo Masini
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Introspection
Authors
rugginoso
1.453K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#