如何使"大纲"视图能够像表视图一样重新排序(拖动以移动行的位置).在我尝试拖动一行时,它只选择其他行.我怎样才能让它重新订购?
你必须实现拖放的东西.
这些是您必须在NSOutlineView数据源中实现的方法.
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id)info proposedItem:(id)item proposedChildIndex:(int)index; - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id )info item:(id)item childIndex:(int)index;
有关详细信息,请查看NSOutlineViewDataSource协议参考.
您还需要为outlineView注册拖动类型
[outlineView registerForDraggedTypes: [NSArray arrayWithObjects: NSStringPboardType, NSURLPboardType, NSFilenamesPboardType,NSFileContentsPboardType, nil]];