• 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: If the NIB instantiates everything how does the controller get a reference to the View and the Model?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: If the NIB instantiates everything how does the controller get a reference to the View and the Model?


  • Subject: Re: If the NIB instantiates everything how does the controller get a reference to the View and the Model?
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 27 Oct 2008 21:06:54 -0500

On Oct 27, 2008, at 8:48 PM, Michael A. Crawford wrote:

If the NIB instantiates everything how does the controller get a reference to the View and the Model?

There are a couple of possibilities:

* The controller is in the nib. This is often the case with an application controller in MainMenu.nib, for example. In that case, you just connect the controller's outlets to the view(s). The application controller often creates the model in code and so has a reference to it that way. It's possible, although I don't particularly recommend it, to instantiate your model object in the nib, too.

* The controller serves as File's Owner for the nib. Again, you connect outlets to views, but from File's Owner which at design time is a stand-in for the object that will own the nib at run time. You have to tell Interface Builder what the class of File's Owner will be so it knows about your outlets. In this case, the controller may have created the model or it might have been passed a reference to the model when it was created (by another, superior controller).

Cheers,
Ken

_______________________________________________

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: If the NIB instantiates everything how does the controller get a reference to the View and the Model?
      • From: "Michael A. Crawford" <email@hidden>
References: 
 >If the NIB instantiates everything how does the controller get a reference to the View and the Model? (From: "Michael A. Crawford" <email@hidden>)

  • Prev by Date: Re: CFPreferences and init: a possible reason?
  • Next by Date: Re: Can we ask iPhone questions yet?
  • Previous by thread: If the NIB instantiates everything how does the controller get a reference to the View and the Model?
  • Next by thread: Re: If the NIB instantiates everything how does the controller get a reference to the View and the Model?
  • Index(es):
    • Date
    • Thread