Posted By

codeRefiner on 11/19/11


Delegate iphone

Versions (?)

Who likes this?

3 people have marked this snippet as a favorite


Steps for setting up the delegate pattern between two objects

 / Published in: Objective C

Just a review, there is no code here. Simply for the mind :)

  1. In review, these are the steps for setting up the delegate pattern between two objects, where object A is the delegate for object B and object B will send out the messages:
  3. - Define a delegate @protocol for object B.
  4. - Give object B a property for that delegate protocol.
  5. - Make object B send messages to its delegate when something interesting happens, such as the user pressing the Cancel or Done buttons, or when it needs a piece of information.
  6. - Make object A conform to the delegate protocol. It should put the name of the protocol in its @interface line and implement the methods from the protocol.
  7. - Tell object B that object A is now its delegate. -> The proper place to do that when you’re using Storyboards is in the prepareForSegue method.

Report this snippet  

You need to login to post a comment.