You should only need add your object to your model (which needs to me KVO compliant). The tree controller will then notice, in response to the KVO notification that a new item was added.
You should rarely, if ever, be direcly adding objects to the controller layer like this. Sent from my iPhone On Jun 18, 2010, at 18:53, Tony Romano <tony...@hotmail.com> wrote: > Scenario: Adding a new node to a NSOutlineView backed by a NSTreeController. > > 1. Create a new internal object add add it to the data store(file system). > This will be my representedObject in the treecontroller > 2. Compute the path and call insertObject:atArrangedObjectIndexPath: > > the treecontroller does 2 things during the call to insertObject: > > 1. It calls my getter, children, and asks me for all the children under the > parent node I have added the new node to. I give it the list INCLUDING the > newly created node since it is now in the store. > 2. Then it calls the setter, setChildren, and gives me the newChildren list. > Which now has an additional copy of the new node, one from the getter call > and one from the insertAt call. I know this for a fact because I purposely > added some data to the newly created node for the insert to distinguish them. > > From the UI, the outlineview is correct, but my internal child list has the > extra node. It's not displayed because the treecontroller optimizes when to > ask me for a childlist. I have a work around which I don't like to basically > lock out the getter method and just return the current child list(i.e the > previous child list which doesn't have the new node added from the file > system). Anyone experience this before and have a recommendation? > > TIA, > -Tony > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/clarkcox3%40gmail.com > > This email sent to clarkc...@gmail.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com