Ric,

There is a very good tutorial from Cocoa Dev Central regarding delegates: http://cocoadevcentral.com/articles/000075.php

And from that article there is a link to another good article as well:
http://www.stepwise.com/Articles/Technical/2000-03-03.01.html

As mentioned in the articles, delegates are used for notification of events that are about to happen. The prospect of "sharing data between controllers" doesn't sound like a good design. The model(s) in your application should handle the storage and access of the data, your controllers will interact with the model in order to read or modify that data. You may have more than one controller accessing the same model, but various controllers don't necessarily send data back and forth between each other, they can send messages to other controllers and their views though.

--
Evan

On Aug 14, 2009, at 5:24 PM, Frederick C. Lee wrote:

Environment: iPhone (but Cocoa as well)... I was using the App Delegate as the link amongst view controllers in sharing data. The 'App Delegate',
being persistent,
was my 'global data' clearing house.

But now I learned that this is frown upon. The preferred way is using
delegation to share data.

From what I've read, delegation is essentially shared procedures via an
informal protocol; albeit the preferred design is to use
the formal protocol with @optional & @required directives.

I think I understand the basics.

But I wonder, how is data actually SHARED between a view controller and its
delegate?

The view controller has an ivar of type 'id' for the delegate, which has
methods declared within the protocol.

Here's some elementary questions:
1) How is the delegate actually launched (with valued parameters)?
2) How does the calling controller receive data back from the delegate?

Regards,
Ric.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/evan.moseman%40gmail.com

This email sent to evan.mose...@gmail.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to