As I build upon my understanding of Objective-C, I’ve been working to better understand the concept of a delegate and when they should be used. In searching for clarity, I came upon an explanation by Mark Hernandez the administrator of iPhoneDevForums.com.
For posterity, I’ve copied Mark’s explanation here. For his full explanation and his code example, follow the link above.
My favorite way to explain how delegates work involves animals.
Let’s say you are going to create a particular bird. You start with a predefined class definition of a bird (provided in the existing framework as, say, CFBird). The existing framework class assumes all birds have certain things in common — they hatch and grow the same, poop the same, fly the same, and lay eggs the same way, etc. (tee hee, I said poop. ) But different birds look different, are different sizes, chirp differently, eat different things, and may mate differently. Continue reading iOS / Objective-C App Delegates Explained Using Birds