Is there a way to make a custom NSWindow work with Spaces

后端 未结 3 1893
别跟我提以往
别跟我提以往 2021-02-03 15:07

I\'m writing an app that has a custom, transparent NSWindow created using a NSWindow subclass with the following:

- (id)initWithContentRect:(NSRect)contentRect s         


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-03 15:18

    Two things here.

    You need to set the window to allow dragging by background, [window setMovableByWindowBackground:YES];

    And If your custom window areas you expect to be draggable are custom NSView subclasses, you must override the method - (BOOL)mouseDownCanMoveWindow to return YES in any NSView subclass that needs to be able to move the window by dragging.

提交回复
热议问题