Reputation: 55
I am creating a Mac application but having difficulty when dragging a window with an image on the view. Basically I can drag the main window but unable to drag the window when clicking and dragging the image view.
I can enable dragging on the main window with "window.movableByWindowBackground = true" seems to work but unable to get this working when dragging the image view on the window.
Any help would be greatly appreciated.
Upvotes: 1
Views: 1417
Reputation: 70096
The trick is to subclass your NSImageView
and override the mouseDownCanMoveWindow
property:
class MyImageView: NSImageView {
override var mouseDownCanMoveWindow:Bool {
return true
}
}
Upvotes: 1