Re: NSOutlineView - Items only displays when user scrolls in outline view
Re: NSOutlineView - Items only displays when user scrolls in outline view
- Subject: Re: NSOutlineView - Items only displays when user scrolls in outline view
- From: Gilles Celli <email@hidden>
- Date: Sun, 02 Oct 2011 11:24:00 +0200
I finally found the bug which caused my NSOutlineView to display the content only if the user was scrolling inside of it, but never showed up correctly at program launch:
The problem was that I've put the method expandItem:exandChildren inside NSOutlineView delegate method outlineView:willDisplayCell:forTableColumn:item:
By placing expandItem:exandChildren after the Outline Items were created it worked: the items appears immediately after the app launch
Hope this helps other developers (some day ;-)
--Gilles
On 2 sept. 2011, at 14:59, Graham Cox wrote:
>
> On 02/09/2011, at 10:48 PM, Gilles Celli wrote:
>
>> Yes forgot to say that I've a data source for the outline view….
>>
>> My OvItem.h class looks like this:
>
>
> Yes, but how and when does that structure get established? That's what matters here - obviously the data structure needs to be ready when the outline view is first set up, or else the outline view needs to be told to reload once the data has come into being.
>
>> @property (retain, nonatomic, readwrite) NSMutableArray *children;
>> @property (nonatomic, assign) BOOL isParent;
>
> Incidentally, why do you make such a strange distinction between parent and leaf nodes even though they are implemented by the same class? A parent could be defined as a node with children (as it is in real life), or if they are truly very different, make them different classes. Usually that sort of thing is better design than trying to give one thing two different mutually-exclusive identities. Not that that has any bearing on your problem….
>
>
> --Graham
>
>
>
>
_______________________________________________
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