Re: add new NSTreenode to NSTreecontroller
Re: add new NSTreenode to NSTreecontroller
- Subject: Re: add new NSTreenode to NSTreecontroller
- From: "email@hidden" <email@hidden>
- Date: Tue, 12 Oct 2010 10:04:06 +0100
On 11 Oct 2010, at 15:23, Alex da Franca wrote:
> I have set up a NSOutlineView with an NSTreecontroller as its datasource. (did the binding in IB)So
You have your terminology jumbled here.
Let's assume we are talking bindings and not datasources.
There is so much terminology involved in Cocoa that its is important to get it right.
>
> But since it works in the first place, I thought, that the objects had been released and therefore deallocated. So I added "retains" "all over the place" in the quest of finding the culprit. To no avail.
Hardly surprising. Bugs are fixed with a scalpel, not a shotgun.
>
> I already spend days googling and trying... :-(
> All I found out, was that the NSTreecontroller is supposed to be buggy and badly designed :-(
> I can't believe, that it still is buggy and if so, that these bugs are so severe, that a simple function like "add" wouldn't work.
Wrong. NSTreeController and NSOutlineView bindings are quite capable of simple functions.
>
> [applicableFilesTreeController add:inode];
>
Read the documentation for NSTreeController -add:
The argument for this method is typically the object that invoked the method not the object to be added.
Try insertObject:atArrangedObjectIndexPath:
You should also be able to update the content array directly but the controller methods are optimized.
You call also add objects directly to NSTreeNode -mutableChildNodes and the controller will update the view accordingly.
Regards
Jonathan Mitchell
Developer
Mugginsoft LLP
http://www.mugginsoft.com_______________________________________________
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