Pregunta

Me gustaría anular el control tinte sistema por defecto para mi aplicación para estar siempre NSGraphiteControlTint. El siguiente código no parece trabajo, sin embargo. ¿Alguna sugerencia?

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

Saludos, Erik

¿Fue útil?

Solución

You set the AppleAquaColorVariant preference:

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

However, if you want it to work the first time the app launches, you must do it before any UI is drawn, in main before calling NSApplicationMain, or you can use a custom subclass of NSApplication, and call it in its -init method before [super init]

Otros consejos

Not all controls are going to respect the control tint. This is even more likely for controls that are rarely used by apps like the window buttons.

That code looks correct. To verify it, try it on something like a radio button or a push button.

To get a small button that looks like a gray version of the close button I think you are going to have to use a button with custom graphics or your own subclass with custom drawing.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top