iPhone but why delegete

I am a newb for iPhone programming..

i see everywhere that delegate is used....i am not sure what for is being used.

can you pls explain me or provide me some link or reference to know about it..

thanks for any help.

Answers


When you need objects to behave differently from each other, you can either give them different implementations (often by subclassing, as is done with UIViewController), or by delegation. The difference is that polymorphism in the first case is achieved by making the objects of different type, whereas in the second, polymorphism is achieved by making objects of the same type delegate certain bits of functionality to objects of arbitrary type.

The reason people like delegation so much is that it allows a much cleaner class hierarchy: you don't need to subclass every little thing, just to respond to a few hooks. That's why we use delegation.

If you want to know the mechanics of delegation, and how to do it in your own classes, you're welcome to see my article Using custom delegates in Objective-C.


Need Your Help

JQuery and find on the TD Element for removing BR

javascript jquery

I'm trying to figure out how to remove BR tags underneath a particular TD element with a specific ID. So far I've had no success. Here is some example code via jfiddle:

For what exactly @XXXXX is used for?

java syntax jboss

Beginner's question. I see a lot of @XXXXX s in our code base. So I would like to know what is the significance of this syntax.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.