Tôi đang cố gắng triển khai kéo thả trong NSCollectionView
sẽ cho phép sắp xếp lại các ô trong chế độ xem. Tôi đã đặt đại biểu và thực hiện các phương thức bên dưới:Ví dụ Kéo thả NSCollectionView Ví dụ
-(BOOL)collectionView:(NSCollectionView *)collectionView writeItemsAtIndexes:(NSIndexSet *)indexes toPasteboard:(NSPasteboard *)pasteboard {
NSLog(@"Write Items at indexes : %@", indexes);
return YES;
}
- (BOOL)collectionView:(NSCollectionView *)collectionView canDragItemsAtIndexes:(NSIndexSet *)indexes withEvent:(NSEvent *)event {
NSLog(@"Can Drag");
return YES;
}
- (BOOL)collectionView:(NSCollectionView *)collectionView acceptDrop:(id<NSDraggingInfo>)draggingInfo index:(NSInteger)index dropOperation:(NSCollectionViewDropOperation)dropOperation {
NSLog(@"Accept Drop");
return YES;
}
-(NSDragOperation)collectionView:(NSCollectionView *)collectionView validateDrop:(id<NSDraggingInfo>)draggingInfo proposedIndex:(NSInteger *)proposedDropIndex dropOperation:(NSCollectionViewDropOperation *)proposedDropOperation {
NSLog(@"Validate Drop");
return NSDragOperationMove;
}
Tôi không chắc chắn cách thực hiện thêm. Với điều này tôi có thể thấy rằng bây giờ tôi có thể kéo xung quanh mục Bộ sưu tập cá nhân nhưng làm cách nào tôi có thể thực hiện Drop
?
xin chào user88975, bạn đã từng giải quyết vấn đề của mình chưa? Tôi đang đối mặt chính xác cùng một vấn đề và tôi không thể tìm thấy bất kỳ trợ giúp nào. – JFS