0

我有NSPopoverwithNSBox和 subviews 是:MKMapViewNSImageView. 在暗模式下,整个 NSBox 为所有子视图添加 gamma/tint。这不会出现在灯光模式下(比较下图)。它似乎与NSVisualEffectView. 如何防止/禁用此效果?

PS:此效果在普通窗口中不显示。只有弹出框受到影响。

黑暗模式 灯光模式

开箱即用的代码拖放元素。莫哈韦 10.14.4

- (IBAction)showPopover:(id)sender {
    [[self popover] showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSRectEdgeMaxX];
}

编辑:APR2020 根据“Adopting advanced features of the new ui of os x yosemite”(youtube),这是因为填充颜色的一些活力效果。Popover 具有有效的外观NSVibrantDarkAppearance

(lldb) po [self.view .effectiveAppearance]
▿ 1 element
  - 0 : <NSCompositeAppearance: 0x60000210a940
 (
    "<NSVibrantDarkAppearance: 0x60000170b840>",
    "<NSDarkAquaAppearance: 0x60000170ae80>",
    "<NSSystemAppearance: 0x60000170afc0>"
)>
lldb) po [self.view .superview]
▿ 1 element
  ▿ 0 : Optional<NSView>
    - some : <NSPopoverFrame: 0x1020a63f0; material: Popover; blendingMode: BehindWindow; state: Active>

所以其他可能的解决方案是使用不鲜艳的填充颜色。

4

1 回答 1

2

通过在窗口内设置混合NSVisualEffectView的地方添加额外的内容来解决。NSBox左(有视觉效果视图),右(没有)。

在此处输入图像描述

于 2019-05-14T12:32:15.793 回答