Why NSWindow without styleMask:NSTitledWindowMask can not be keyWindow?

后端 未结 2 1984
孤独总比滥情好
孤独总比滥情好 2020-12-01 11:26

Problem: I have one window mainWindow and another childWindow added to mainWindow. childWindow is kind of WindowExt class. This class

相关标签:
2条回答
  • 2020-12-01 11:58

    That’s a Cocoa design decision: windows without title or resize bar cannot become key window by default.

    If you want a titleless window to be able to become a key window, you need to create a subclass of NSWindow and override -canBecomeKeyWindow as follows:

    - (BOOL)canBecomeKeyWindow {
        return YES;
    }
    
    0 讨论(0)
  • 2020-12-01 12:20

    you can set the style mask to NSBorderlessWindowMask in order to make it borderless

    0 讨论(0)
提交回复
热议问题