0

我想将我的应用程序的默认系统控制色调覆盖为 always NSGraphiteControlTint。以下代码似乎不起作用。有什么建议么?

NSButton *button = [window standardWindowButton:NSWindowCloseButton];
[[button cell] setControlTint:NSGraphiteControlTint];

问候, 埃里克

4

2 回答 2

1

您设置 AppleAquaColorVariant 首选项:

[[NSUserDefaults standardUserDefaults] setInteger:NSGraphiteControlTint forKey:@"AppleAquaColorVariant"];

但是,如果您希望它在应用程序第一次启动时工作,您必须在绘制任何 UI 之前,在main调用之前执行它NSApplicationMain,或者您可以使用自定义子类NSApplication,并在其-init方法之前调用它[super init]

于 2011-01-30T01:00:09.623 回答
0

并非所有控件都会尊重控件色调。对于窗口按钮等应用程序很少使用的控件,这种情况更有可能发生。

该代码看起来正确。要验证它,请在单选按钮或按钮之类的东西上试一试。

要获得一个看起来像关闭按钮的灰色版本的小按钮,我认为您将不得不使用带有自定义图形的按钮或您自己的带有自定义绘图的子类。

于 2010-09-25T23:13:07.933 回答