How to change NSPopover background color include triangle part?

后端 未结 8 628
无人及你
无人及你 2020-12-02 23:25

How can I change NSPopover background color include triangle part?

\"enter

8条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 00:07

    The solution by Mike Bedar is working, but with adding just one more thing (in order to get the triangle filled with background color), and that is to override the draw function inside the PopoverContentView as well:

     override func draw(_ dirtyRect: NSRect) {
        backColor.set() // backColor is NSColor
        NSRectFill(self.bounds)
    }
    

提交回复
热议问题