我有以下代码来支持将应用程序文件拖放到表格视图中。问题是当我拖放时我什至看不到绿色+。我认为这与它有关,registerForDraggedTypes:
但我不确定。我尝试了很多教程,但没有一个对我有用。
- (void)awakeFromNib {
[apps registerForDraggedTypes:[NSArray arrayWithObject:@"app"]];
}
- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard
{
return YES;
}
- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)op
{
return NSDragOperationCopy;
}
- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id <NSDraggingInfo>)info
row:(int)row dropOperation:(NSTableViewDropOperation)operation
{
return YES;
}
提前致谢