• 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: File's Owner
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File's Owner


  • Subject: Re: File's Owner
  • From: Ken Thomases <email@hidden>
  • Date: Sun, 25 May 2008 04:44:36 -0500

On May 25, 2008, at 4:14 AM, mmalc crawford wrote:

On May 25, 2008, at 2:01 AM, Roland King wrote:

Where do I make the model object and how do I hook it into the controller? I start the application, the Files Owner is the singleton NSApplication, I guess I can override the NIB finished loading method, make the model object there and now I want to call something on the controller like ...
-(Controller)hereIsYourModelObject:(Model*)model


If you override -awakeFromNib then you'd do so in the controller class, so it would create and set its own model. There's no need to invoke a separate hereIsYourModelObject: method, except in the sense of a setModelObject: accessor.
Alternatively you could do it in -init...


This is akin to, in the document architecture, the document object setting its model by retrieving it from a file.

Another approach is to not put the controller in the nib. Have the controller be the File's Owner. So, the controller is created in code in response to some action or notification or delegate method (e.g. applicationWillFinishLaunching:). Then the nib is loaded, and the controller is passed in as its owner. In the nib, everywhere that you had a connection to or from the controller, you make that connection to or from the File's Owner.


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


References: 
 >Re: File's Owner (From: Johnny Lundy <email@hidden>)
 >Re: File's Owner (From: Scott Anguish <email@hidden>)
 >Re: File's Owner (From: Roland King <email@hidden>)
 >Re: File's Owner (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: IB outlets and NSCollectionViews
  • Next by Date: Re: How to Delay, Wait, Pause...
  • Previous by thread: Re: File's Owner
  • Next by thread: Re: File's Owner
  • Index(es):
    • Date
    • Thread