Why NSWindow without styleMask:NSTitledWindowMask can not be keyWindow?

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;
}

Leave a Comment