NSWindow with round corners and shadow

后端 未结 11 1832
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 02:26

I\'m trying to crate a NSWindow without title bar (NSBorderlessWindowMask) with round corners and a shadow, similar to the below \"Welcome

11条回答
  •  感情败类
    2020-12-23 03:09

    Objective C example of @Eonil's answer:

    [window setBackgroundColor:[NSColor whiteColor]];
    [window setOpaque:NO];
    [window setStyleMask:NSResizableWindowMask | NSTitledWindowMask | NSFullSizeContentViewWindowMask];
    [window setMovableByWindowBackground:YES];
    [window setTitlebarAppearsTransparent:YES];
    [window setTitleVisibility:NSWindowTitleHidden];
    [window setShowsToolbarButton:NO];
    [window standardWindowButton:NSWindowFullScreenButton].hidden = YES;
    [window standardWindowButton:NSWindowMiniaturizeButton].hidden = YES;
    [window standardWindowButton:NSWindowCloseButton].hidden = YES;
    [window standardWindowButton:NSWindowZoomButton].hidden = YES;
    [window makeKeyWindow];
    

提交回复
热议问题