• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sending message to parent object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sending message to parent object


  • Subject: Re: Sending message to parent object
  • From: Robert Marini <email@hidden>
  • Date: Fri, 26 Dec 2008 23:37:17 -0500

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 (email@hidden)

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:
This email sent to email@hidden

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

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Sending message to parent object (From: Ashley Perrien <email@hidden>)

  • Prev by Date: Re: NSSpeechRecognizer and Speech Recognition calibration
  • Next by Date: Re: Quartz Bindings
  • Previous by thread: Sending message to parent object
  • Next by thread: Core Data - fresh data for text field not connected to array controller
  • Index(es):
    • Date
    • Thread