• 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: "Michael A. Crawford" <email@hidden>
  • Date: Mon, 27 Oct 2008 20:28:07 -1000

I was missing the IBOutlet keyword in the class declaration.  Thanks.

-Michael

On Oct 27, 2008, at 4:06 PM, Ken Thomases wrote:

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


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

  • Prev by Date: Re: How to check the number of pending events in the application event queue?
  • Next by Date: KVO and array item observation
  • Previous by thread: Re: If the NIB instantiates everything how does the controller get a reference to the View and the Model?
  • Next by thread: Re: Why "self"? (Was: Newbie: Referencing Objects)
  • Index(es):
    • Date
    • Thread