How to determine if a drag operation was canceled using NSDraggingInfo or similar?

I created a subclass of NSImageView and implemented an unofficial protocol for dragging images between other instances of the same class. I keep a link to the view image before the drag operation and can set it back to the specified image with certain criteria.

However, I cannot determine if the drag operation was canceled. I know that the draggingEnded method is being called, but it is also being called when the drag was successful. Any ideas?

+3
source share
1 answer

. , operation, NSDraggingSource draggedImage:endedAt:operation:, , .

draggedImage:endedAt:operation: :

if (operation == NSDragOperationNone)
    return;

// Otherwise perform any drag completion tasks.
+3

Source: https://habr.com/ru/post/1754134/


All Articles