Reporting Bugs in Apple Sample Code (NSOutlineView, NSTreeController and Bindings)
Reporting Bugs in Apple Sample Code (NSOutlineView, NSTreeController and Bindings)
- Subject: Reporting Bugs in Apple Sample Code (NSOutlineView, NSTreeController and Bindings)
- From: Jonathan Dann <email@hidden>
- Date: Sat, 12 Jan 2008 18:46:27 +0000
Hi Guys,
Probably not one of their most pressing matters, but should I file a
radar with a simple fix for a bug in one of Apple's sample codes? Is
it useful for them, as I'm sure loads of developers look at this
particular sample code?
It's the one called SourceView, which shows how to build up a sample
source list à la iTunes. The drag and drop method has an error.
// myWindowController.m
// -handleInternalDrops:
NSInteger i;
for (i = ([newNodes count] - 1); i >=0; i--)
{
[treeController moveNode:[newNodes objectAtIndex:i]
toIndexPath:indexPath];
}
should read:
NSEnumerator *enumerator = [newNodes reverseObjectEnumerator]
NSMutableArray *reverseDragArray = [[NSMutableArray alloc] init];
for(id item in enumerator)
[reverseDragArray addObject:item];
[treeController moveNodes:reverseDragArray toIndexPath:indexPath];
Their way means the dragged nodes end up all over the place when
dragging into a group (folder) as the indexPath is not updated after
each node is moved. Obviously I've use fast enumeration to clean it up
too, but the idea is to not move the nodes one at a time!
Other than that its great sample code if you want the iTunes look and
need to work out using NSOutlineView, NSTreeController and Bindings,
check it out:
http://developer.apple.com/samplecode/SourceView/index.html
Jonathan
_______________________________________________
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