There is generally any number of ways, as you indicate. In some cases your solution to the problem might be a target/action-like system.

Generally KVO will be more flexible but is not without it's own unique set of problems (I'd suggest looking at http://shiftedbits.org/2008/07/24/key-value-observing-improvements/ and http://www.mikeash.com/?page=pyblog/key-value-observing-done-right.html) . I'd actually take this approach for the scenarios you described. I'd suggest taking a look at the Cocoa Fundamentals vide on the iPhone dev center as a similar example is given there.

-rob.

On Dec 26, 2008, at 11:11 AM, Ashley Perrien wrote:

I'm still relatively new to Cocoa (and programming in general) and very new to iPhone but this is more of a general question I've been struggling with.

What is the best / most accepted way to get a message out of an object?

Scenario 1:
I have a document application with an NSView that is basically a graph of a subset of the data in the document. I'd like to bo able to drag within the graph and have it change what data it's showing. How would I send a message from the view to the document either telling it to update the selection or to request new data? Delegate? Notification? Singleton? Other?

Scenario 2:
iPhone app (extremely simple, one view) again with data and a graph of that data. when interacting with the UIView, how do I tell the parent view that something needs changing?

Basically, what's the most acceptable way for an ivar object to communicate with it's parent?


Ashley Perrien
Random Quote of the day:
"If you understand what you're doing, you're not learning anything."
-Abraham Lincoln

_______________________________________________

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/rob%40pinchmedia.com

This email sent to r...@pinchmedia.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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