Home > DeveloperSection > Interviews > What is delegate pattern in iOS?

Posted on    August-04-2015 11:08 PM

 iPhone iPhone  Ios  Objective C 
 1 Answer(s)
  366  View(s)
Rate this:

Glen Martin
Glen Martin

Total Post:4

Posted on    August-04-2015 11:08 PM

Delegation is a mechanism by which a host object embeds a weak reference (weak in the sense that it’s a simple pointer reference, unretained) to another object—its delegate—and periodically sends messages to the delegate when it requires its input for a task. The host object is generally an “off-the-shelf” framework object (such as an NSWindow or NSXMLParserobject) that is seeking to accomplish something, but can only do so in a generic fashion. The delegate, which is almost always an instance of a custom class, acts in coordination with the host object, supplying program-specific behavior at certain points in the task. Thus delegation makes it possible to modify or extend the behavior of another object without the need for subclassing.Refer: delegate pattern.

Don't want to miss updates? Please click the below button!

Follow MindStick