我已经创建了用于管理 PXListView 的 NSViewController ......代表与文件所有者连接......
这里一切都按预期工作..除了拖放...
拖动时它没有进入拖动委托功能......并且在拖动时它没有显示+符号(即拖动符号)......并且拖动单元格重新定位到其原始位置
#import "PXListView.h"
@interface ListViewController : NSViewController <PXListViewDelegate>
{
IBOutlet PXListView *listView;
NSMutableArray *_listItems;
int count;
}
- (void)addCell;
@end
- (BOOL)listView:(PXListView*)aListView writeCellsWithIndexes:(NSIndexSet*)rowIndexes toPasteboard:(NSPasteboard*)dragPasteboard
{
// +++ Actually drag the items, not just dummy data.
[dragPasteboard declareTypes: [NSArray arrayWithObjects: NSStringPboardType, nil] owner: self];
[dragPasteboard setString: @"Just Testing" forType: NSStringPboardType];
return YES;
}
- (NSDragOperation)listView:(PXListView*)aListView validateDrop:(id <NSDraggingInfo>)info proposedCell:(NSUInteger)row
proposedDropHighlight:(PXListViewDropHighlight)dropHighlight;
{
return NSDragOperationCopy;
}
- (BOOL)listView:(PXListView*)aListView acceptDrop:(id <NSDraggingInfo>)info row: (NSUInteger)row dropHighlight:(PXListViewDropHighlight)dropHighlight
{
NSLog(@"Accept Drop");
ListViewThumbnailObject *temp = [_listItems objectAtIndex: [listView selectedCell]];
[_listItems removeObjectAtIndex: [listView selectedCell]];
[_listItems insertObject: temp atIndex: row];
[listView reloadData];
return YES;
}
它没有进入与拖动相关的委托方法..
在“nib”文件中,委托与文件所有者连接......
谁能建议我如何解决这个问题?
谢谢,穆图