I have found the documentation of this to be somewhat unclear, and among other things the new ways to do it were added in Lion.
Assuming you need this for 10.7 or higher, then this could be a skeleton for you implementation:
In your data source/delegate class, implement:
-(void) enableDragNDrop
{
[self.outlineView registerForDraggedTypes: [NSArray arrayWithObject: @"DragID"]];
}
- (id <NSPasteboardWriting>)outlineView:(NSOutlineView *)outlineView pasteboardWriterForItem:(id)item
{
if ( dontDrag ) {
return nil;
}
NSString *stringRep = [item uniqueStringRepresentation];
NSPasteboardItem *pboardItem = [[NSPasteboardItem alloc] init];
[pboardItem setString:stringRep forType: @"DragID"];
return pboardItem;
}
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id < NSDraggingInfo >)info proposedItem:(id)item proposedChildIndex:(NSInteger)index
{
BOOL dragOK =
if ( dragOK ) {
return NSDragOperationMove;
}
else {
return NSDragOperationNone;
}
}
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id < NSDraggingInfo >)info item:(id)item childIndex:(NSInteger)index
{
}
There is a good deal of code needed to be filled in for the last method, and regarding the animated movement, Apple's complex table view demo code mentioned in samir's comment is quite useful, if somewhat complex to decipher.