Search code examples
cocoanspanel

Moving NSPanel by background with some NSViews on it


I have a NSPanel. When the panel is empty, is moves well with holding and dragging it's background. However, If I put something on it, the area covered by new view won't be draggable anymore. As an example, I could put a NSImageView fills the panel fully. And the panel do not being dragged anymore. However I want to make this draggable even user holding on the image view. What should I do to do this?


Solution

  • You have to subclass your NSImageView and implement - (BOOL)mouseDownCanMoveWindow to return YES. Then you'll be able to drag the window wherever you click.