Re: NSOutlineView woes
Re: NSOutlineView woes
- Subject: Re: NSOutlineView woes
- From: Quincey Morris <email@hidden>
- Date: Sun, 20 Mar 2016 23:02:40 -0700
- Feedback-id: 167118m:167118agrif8a:167118sjwERCyVf2:SMTPCORP
On Mar 20, 2016, at 20:20 , Graham Cox <email@hidden> wrote:
>
> This is driving me insane!
a. Can you produce a test project that demonstrates the behavior? (Preferably not via drag-and-drop, since that’s so much harder to debug.)
b. It’s not the actual problem, but I wonder why you construct the needed parent-relative index set by using ‘rowForItem:’? I may be wrong, but I don’t think we can assume that NSOutlineView keeps references to all or any subset of the universe of items in the list, so it may have to walk the rows starting from the root item, and this certainly opens the possibility of dicey behavior if your data structures are in the process of being changed. I certainly wouldn’t assume it can find the row more efficiently than you can find the child index. Since you know the child, you know the parent, so you can find child index by iterating linearly through the parent’s children yourself.
c. There’s also a logic issue here. It’s not clear whether you’re making a mistake, or the mistake is only an apparent consequence of the way you’ve described your methodology: It is incorrect, in general, to compute the child index by subtracting the child row from the parent row, because there may be intervening children which themselves have children.
_______________________________________________
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