我无法为NSOutlineView启用拖放功能.我已经实现了NSOutlineView Delegate的相关方法.
但似乎当我点击一个项目时,我甚至无法拖动它(我看不到动画).
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id < NSDraggingInfo >)info item:(id)item childindex:(NSInteger)index { return YES; } - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id < NSDraggingInfo >)info proposedItem:(id)item proposedChildindex:(NSInteger)index { return NSDragOperationMove; //not sure about this one. }
谢谢
更新:
我正在实现forOSX> = 10.5
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard { Nsstring *pasteBoardType = [self pasteboardTypeForTableView:outlineView]; [pboard declareTypes:[NSArray arrayWithObject:pasteBoardType] owner:self]; NSData *rowData = [NSKeyedArchiver archivedDataWithRootObject:items]; [pboard setData:rowData forType:pasteBoardType]; return YES; }
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。