• 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: fundamental question: how do I call controller methods from other classes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fundamental question: how do I call controller methods from other classes?


  • Subject: Re: fundamental question: how do I call controller methods from other classes?
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 21 May 2008 22:20:31 -0700


On 21 May '08, at 8:15 PM, Matthew Youney wrote:

I just have no mechanism of sending messages
to my "controller" class from my "model" objects unless the "controller"
makes the call.

Typically the model doesn't "know about" the controller (or the view). Instead it posts notifications when it changes, and the controllers/ views listen for those. That's what key-value observing is designed for, or you can use NSNotifications. (Look either of those up in the overview docs if you need details.)


This separation helps keep the model abstract and reusable. It also makes it easier to handle multiple views of the same data, as happens with multi-window or splittable UIs, as well as inspector panels.

—Jens

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

  • Follow-Ups:
    • RE: fundamental question: how do I call controller methods from other classes?
      • From: "Matthew Youney" <email@hidden>
References: 
 >RE: fundamental question: how do I call controller methods from other classes? (From: "Matthew Youney" <email@hidden>)

  • Prev by Date: Re: ObjC Question - labeled arguments
  • Next by Date: Re: fundamental question: how do I call controller methods from other classes?
  • Previous by thread: RE: fundamental question: how do I call controller methods from other classes?
  • Next by thread: RE: fundamental question: how do I call controller methods from other classes?
  • Index(es):
    • Date
    • Thread