Mr_Fulano
asked on
Question regarding "Delegates"
Hi, I'm learning Objective-C and am having a little bit of a struggle with the concept of "Delegates."
I've programmed on other languages, such as VB.NET and some C#.NET, but I'm confused about how Delegates work (which I've seen mostly in iPhone programming) or why have them at all.
Could someone please provide a simple explanation of how and why Delegates are used?
Thanks you,
Fulano
I've programmed on other languages, such as VB.NET and some C#.NET, but I'm confused about how Delegates work (which I've seen mostly in iPhone programming) or why have them at all.
Could someone please provide a simple explanation of how and why Delegates are used?
Thanks you,
Fulano
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In non technical terms imagine you have two things. Thing 1 is controlling thing 2. But thing 2 has certain messages that it itself tells the world about it. So a thing can say I want to be the receiver of these messages. This thing could be 1 or could be another thing. Thus one of the features. Thing 2 does not know to whom it is sending its messages.
Normally Thing 1 might be a view controller and Thing 2 a table view and the table wants to send a message that it was touched at a certain row. Thing 1 will normally want to know this, but you could nominated thing 3 to be getting the table view messages.