• 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: Binding Tree Controller to a singleton
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding Tree Controller to a singleton


  • Subject: Re: Binding Tree Controller to a singleton
  • From: Florent Pillet <email@hidden>
  • Date: Sun, 16 Mar 2008 22:36:14 +0100


Michael Hanna wrote:
My question is, how do I make a keypath from the tree controller to
the treeModel, since it's sitting inside a singleton? Would
programmatically setting the binding accomplish this?

If you have a NSApp subclass, an easy way to accomplish this is to add an accessor method there, i.e.:


- (id)dataModelMgr
{
	return [MyDataModelManager getInstance];
}

Then bind your tree controller to the "Shared Application" object with keypath @"dataModelMgr.treeDataModel" (or simplify this and have your accessor directly return the tree data model).

Also, would it be necessary for  MyTreeDataModel be an
NSArrayController subclass?

Why should it? As long as it complies with the NSTreeController requirements (see the documentation) you should be fine.


Note, though, that NSTreeController can be a pain to work with. Especially if you plan on supporting 10.4. But that's just my opinion...

--
Florent Pillet                        http://www.florentpillet.com
Software consultant - Mobile devices, desktop and server platforms
Mac OS X, iPhone, WinMob, Palm OS    Skype callto://florent.pillet
_______________________________________________

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: 
 >Binding Tree Controller to a singleton (From: "Michael Hanna" <email@hidden>)

  • Prev by Date: Re: Another newbie, into and cry for help...
  • Next by Date: Re: Moving a window to another Spaces space?
  • Previous by thread: Binding Tree Controller to a singleton
  • Next by thread: XCode3 & NSLog & Tiger compatibility
  • Index(es):
    • Date
    • Thread