• 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: Another NSTreeController/NSOutlineView/NSIndexPath Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another NSTreeController/NSOutlineView/NSIndexPath Question


  • Subject: Re: Another NSTreeController/NSOutlineView/NSIndexPath Question
  • From: Gordon Apple <email@hidden>
  • Date: Thu, 11 Jun 2015 10:22:06 -0500
  • Thread-topic: Another NSTreeController/NSOutlineView/NSIndexPath Question

If you are going to use a data hierarchy, then use a data hierarchy. Look
like you are attempting to use a linear array, which won¹t work. You need
arrays of arrays and you bind the tree controller to the root array.


On 6/10/15 10:45 PM, "email@hidden"
<email@hidden> wrote:

> Hi All, Is there any documentation available on NSTreeController other than
> the Reference Manual? I¹ve found confusing and contradictory comments on
> NSTreeController and I¹d like clarification if possible. I¹m confused about
> how Index Paths are used. I have a ViewController that is uses a NIB based
> Outline View and Tree Controller, it is based on the SourceView project. This
> works fine, but now I¹ve got to add some data to another section. I have flat
> array of ID Strings that represent objects in a Hierarchy, these take the
> form: RootContainer RootContainer ~ContainerA RootContainer ~ContainerB
> RootContainer ~ContainerA~LeafA RootContainer ~ContainerA~LeafB RootContainer
> ~ ContainerB ~LeafA RootContainer ~ ContainerB ~LeafB The Array is sorted so
> that the lowest items in the Hierarchy appear in the list first. For instance
> for the above ID array, I would create: Root Node (Container)   Index Path n
> (the next available section in the Root) ContainerA     Index Path :n.0
> ContainerB     Index Path :n.1 LeafA      Index Path :n.0.0 LeafB      Index
> Path :n.0.1 LeafA      Index Path :n.1.0 LeafB      Index Path :n.1.1 I am
> using "insertObject: atArrangedObjectIndexPath:" to Insert Objects into the
> Tree. My confusion lies in how to compute the Index Paths. I had thought to
> scan the ViewController/TreeController ³ContentArray² to find the initial
> Index Path, but is this safe? I other words does the position of a Node in the
> ³ContentArray² Hierarchy correspond to the position I need to pass to "
> insertObject: atArrangedObjectIndexPath:² ? The only other way I can see of
> doing it would be to use the TreeController¹s ³Current Selection² Methods, but
> they are quite cumbersome to use and seem to slow it down a *lot*, so I¹d
> rather avoid doing it this way if possible. Thanks for any help or
> suggestions. All the Best Dave


_______________________________________________

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: Another NSTreeController/NSOutlineView/NSIndexPath Question
      • From: Dave <email@hidden>
  • Prev by Date: Re: Playground
  • Next by Date: IOS focus issue when presenting a view controller from a new storyboard
  • Previous by thread: Another NSTreeController/NSOutlineView/NSIndexPath Question
  • Next by thread: Re: Another NSTreeController/NSOutlineView/NSIndexPath Question
  • Index(es):
    • Date
    • Thread