3 ms·
Apple has their description of delegation here: http://developer.apple.com/library/IOs/#documentation/iPhone/Conceptual/iPhone101/Articles/02_DesignPatterns.htm
by Xuzz 15y ago
Apple has their description of delegation here: http://developer.apple.com/library/IOs/#documentation/iPhone/Conceptual/iPhone101/Articles/02_DesignPatterns.html http://developer.apple.com/library/IOs/#documentation/iPhone...
Delegation is a design pattern in which one object sends messages to another object that has been specified as its delegate, to ask for input or to notify the delegate that an event is occurring. The delegate object responds to these messages in a custom way. Delegation is a common design pattern in Cocoa Touch apps because it allows you to provide custom behavior without having to subclass and override the methods of a complex framework object, such as UIApplication.
It's probably confusing, really, to read about the delegation "design pattern" as on Wikipedia. Instead, it's mostly just a way to avoid subclassing: specify another object, the "delegate", to provide the information or react to an event, rather than do something like subclass and override specific methods for an event.
I hope that helped, maybe a tiny bit. If not, here's a +15 voted answer on Stack Overflow about it: http://stackoverflow.com/a/1792862/188512 http://stackoverflow.com/a/1792862/188512