How can I display the spinning NSProgressIndicator in a different color?

前端 未结 9 1711
温柔的废话
温柔的废话 2020-12-03 01:27

I am using a \"spinner\" NSProgressIndicator in my cocoa app:

I would like to display it in a different color so that it will show up well on a dark backgr

相关标签:
9条回答
  • 2020-12-03 01:58

    If you’re targeting Mojave or later, you can just set the spinner’s appearance to dark aqua. This will always give you a white spinner, regardless of the user’s system appearance.

    spinner.appearance = NSAppearance(named: .darkAqua)
    
    0 讨论(0)
  • 2020-12-03 02:06

    I've seen some third party HUD-style control frameworks that include the bar style NSProgressIndicator, but unfortunately I don't remember ever seeing the spinner. If you can't find a way to get it to do what you want, this page can generate an animated gif that might be helpful for making your own.

    0 讨论(0)
  • 2020-12-03 02:08

    This is what I've done:

        #import <QuartzCore/QuartzCore.h>
    
        ...
    
        CIFilter *lighten = [CIFilter filterWithName:@"CIColorControls"];
        [lighten setDefaults];
        [lighten setValue:@1 forKey:@"inputBrightness"];
        [self.indicator setContentFilters:[NSArray arrayWithObjects:lighten, nil]];
    
    0 讨论(0)
提交回复
热议问题