I have an NSOutlineView subclass that implements the NSSpringLoadingDestination.
The outline view is populated with NSTableCellViews. Each table cell view has an NSTextField and NSImageView. It looks just like the name column in the Finder window: icon and text.
When I drag a row over the text field in another row everything works fine. When the cursor goes over the NSImageView, however, the spring loading exits.
The outline view also loses the highlight for that row.
If I replace the image view with an NSButton containing the image, the spring loading does not exit. And the outline view maintains the highlight.
Can anyone tell me why an NSControl does not interrupt the spring loading but an NSImageView does?
I have tried overriding some different NSView methods but I can’t get the image view to behave like the button.
Thanks.
Even when an image view is uneditable it apparently still handles drag & drop. To fix this call the image view's unregisterDraggedTypes
method.
来源:https://stackoverflow.com/questions/48014975/nsoutlineview-spring-loading-exits-over-nsimageview-but-not-nsbutton