mac下borderless的window(无标题栏)如何实现

子类化NSWindow:

- (void)awakeFromNib

{

    [selfsetStyleMask:NSBorderlessWindowMask];

    [selfsetAcceptsMouseMovedEvents:YES];

    [selfsetMovableByWindowBackground:YES];

    [selfsetLevel:NSNormalWindowLevel];

    [self setOpaque:NO];

    [selfsetBackgroundColor:[NSColorclearColor]];

}

 

- (BOOL) canBecomeKeyWindow { return YES; }

- (BOOL) canBecomeMainWindow { return YES; }

- (BOOL) acceptsFirstResponder { return YES; }

- (BOOL) becomeFirstResponder { return YES; }

- (BOOL) resignFirstResponder { return YES; }

你可能感兴趣的:(window)