Created
February 8, 2014 04:27
-
-
Save keicoder/8876702 to your computer and use it in GitHub Desktop.
objective-c : steps for setting up the delegate pattern between two objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//steps for setting up the delegate pattern between two objects | |
//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: | |
//1. Define a delegate @protocol for object B. | |
//2. Give object B a property for that delegate protocol. | |
//3. 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. | |
//4. 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. | |
//5. Tell object B that object A is now its delegate. | |
//This means there is one more thing you need to do: | |
//tell AddItemViewController that the ChecklistsViewController is now its delegate. | |
//The proper place to do that when you’re using storyboards is in the prepareForSegue:sender: method. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment