• 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: NSOutlineView, NSTreeController and Sample Code "Source View"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView, NSTreeController and Sample Code "Source View"


  • Subject: Re: NSOutlineView, NSTreeController and Sample Code "Source View"
  • From: Jonathan Dann <email@hidden>
  • Date: Sun, 17 Feb 2008 17:38:21 +0000


On 17 Feb 2008, at 15:25, Ralph Manns wrote:

How can I add a ChildNode to a Node that is not selected in the OutlineView.

You have to use NSTreeController's -setSelectionIndexPath: and give it the index path of the object you want to add the child node to. Follwing this you can then add a node as you normally would.


Getting the index path of the node you want is the tricky part as NSTreeController still has no -indexPathForObject: that you can send it one of your Node objects and it will find it in the tree. I recommend having a look at Wil Shipley's blog post on the subject where he writes such a method as a category on NSTreeController.

http://www.wilshipley.com/blog/2006/04/pimp-my-code-part-10-whining-about.html

Alternatively you have to use -insertObject:atArrangedObjectIndexPath:

I've used this example code a lot, so feel free to ask away.

Jon
_______________________________________________

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: 
 >NSOutlineView, NSTreeController and Sample Code "Source View" (From: Ralph Manns <email@hidden>)

  • Prev by Date: Re: A couple questions relevant to games
  • Next by Date: Re: determining free memory
  • Previous by thread: NSOutlineView, NSTreeController and Sample Code "Source View"
  • Next by thread: A couple questions relevant to games
  • Index(es):
    • Date
    • Thread