NSPopover color

前端 未结 3 1787
终归单人心
终归单人心 2021-02-15 10:48

Is there any way to color NSPopover? Ive seen apps like facetab etc that have cool colors and resizeable popovers, how is this done?

Ay guides, hints?

Thanks.

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-15 11:13

    Set popover.contentViewController.view as a subclass of NSView with a custom background drawing (i.e. override drawRect: and fill a rect with your custom background color).

    Then set the popover.appearance = NSPopoverAppearanceHUD to remove the default border around the view.

    Note that there will still be a very thin border around the view, so if you want to remove it completely, you may want to use MAAttachedWindow or a similar solution.

提交回复
热议问题