Search code examples
iphoneobjective-ciosios5ios4

passing data using delegates between viewcontrollers without any navigation controller connection


There are many examples of passing data between two view controllers, where one view controller navigates to another view controller.

But is it possible to pass data using custom protocols & delegates between view controllers that are not connected by navigation controller?

So, an example could be: Three view controllers namely are, A,B,C. A navigates to B, and Bnavigates to C. I know how to pass data between A & B using custom protocols & delegates. But can we pass data between C & A. Thus A can be C's delegate and thereby can receive data from C. Is this possible?

Any help would be appreciated.


Solution

  • One way is use delegates for backward passing of data

    Refer simple-delegate-tutorial-for-ios link for passing data from C to A controller.

    Check basic-delegate-example link.

    Another way is by posting notification. for backward passing of data

    Check Comunicate-Two-Views link.