I'm trying to implement a drag & drop for NSTableCellView
look like screenshot, but the only thing i can do just the text, not a whole cell like screenshot bellow :(
Asked
Active
Viewed 661 times
-1

Antony Raphel
- 2,036
- 2
- 25
- 45

Mark G
- 53
- 5
2 Answers
0
The Dragged Image
The image that is dragged in a dragging session is simply an image that represents the data on the pasteboard. Although a dragging destination can access the image, its primary concern is with the pasteboard data that the image represents—the dragging operation that a destination ultimately performs is on the pasteboard data, not on the image itself.
0
Here is my answer for my question :)
NSView to NSImage: link
Override draggingImageComponents
in NSTableCellView
subclass
-(NSArray *) draggingImageComponents{
self.layer.opacity = 0.5;
NSImage *image = [self imageRepresentation];
self.layer.opacity = 1;
NSDraggingImageComponent *draggingImage = [NSDraggingImageComponent draggingImageComponentWithKey:@"background"];
draggingImage.contents = image;
draggingImage.frame = self.bounds;
return @[draggingImage];
}

Mark G
- 53
- 5