Keep NSWindow front

后端 未结 6 1388
暗喜
暗喜 2021-01-04 01:24

I open a NSWindow from my main NSWindow.

DropHereWindowController *dropHereWindowController = [[DropHereWindowController alloc] initWithWindowNibName:@\"Drop         


        
6条回答
  •  独厮守ぢ
    2021-01-04 02:25

    Swift 4.0, Xcode 9.0

    You can set the level property of your NSWindow to floating. For example, if you are subclassing NSWindow, you can set it in the override init.

    self.level = .floating
    

    You also can get NSWindow from your NSWindowController by self.window?.

    There are different levels:

    NSNormalWindowLevel

    The default level for NSWindow objects.

    NSFloatingWindowLevel

    Useful for floating palettes.

    NSSubmenuWindowLevel

    Reserved for submenus. Synonymous with NSTornOffMenuWindowLevel, which is preferred.

    NSTornOffMenuWindowLevel

    The level for a torn-off menu. Synonymous with NSSubmenuWindowLevel.

    NSModalPanelWindowLevel

    The level for a modal panel.

    NSMainMenuWindowLevel

    Reserved for the application’s main menu.

    NSStatusWindowLevel

    The level for a status window.

    NSPopUpMenuWindowLevel

    The level for a pop-up menu.

    NSScreenSaverWindowLevel

    The level for a screen saver.

提交回复
热议问题