tags:

views:

78

answers:

1

Hi, i want to know how Delegate is differ from object in cocoa any good articles.

Thanks.

+6  A: 

A delegate is just object that another object sends messages to... when any event happen, so that it can handle application-specific details the original object wasn't designed for. It's a way of customizing behavior without subclassing....

mihirpmehta
Relevant documentation: http://developer.apple.com/mac/library/documentation/General/Conceptual/DevPedia-CocoaCore/Delegation.html
Peter Hosey
nice answer mihirpmehta thanks.....
jeeva
Thanks...... :)
mihirpmehta
what edited refers in this forum if i ask question and some one edited it .. what it mean..
jeeva
It means in most of the cases some one has added or removed tags of your question... and rarely sometimes edited the question itself...(as only few user can do it...)
mihirpmehta
ok Thanks mihirpmehta ...... :)
jeeva
Hi thanks for all of u for ur nice answers and suggestions....I want to go still in-depth on Delegation...Is any one tell how delegation internally works means if we set delegate how such methods call itself when we overrides them.....
jeeva
I haven't Seen Internal coding but there should be something like this... Every Class (UIView, UITextfield has one object delegate of general type i.e. id) when you write myTextFileld.delegate = self ... that self (self is equivalent to this pointer ) is assign to delegate.. so now for every event generated by user... iphone's main event loop call [delegate methodName]; for every appropriate object that is initialized in memory pool.... and if delegate is assign to some class that particular method will be called... something like that should be happened....
mihirpmehta
ha this is good answer mihirpmehta ... but i am still felling delegate mechanism as wonder.
jeeva
yes at a first glance it might be seem that way... It's Complex Callback - Function Pointer - virtual functions combined features....
mihirpmehta