0

I'm using https://github.com/kelan/yrk-spinning-progress-indicator to get a white colored spinner. Note that this is not a subclass of NSProgressIndicator, but instead a custom NSView.

The problem is that the corners of this custom view are showing as white, instead of just a clear background. You can see this in this image:

Screenshot.

This is the code I have :

[_statusProgressIndicator setColor:[NSColor whiteColor]];
[_statusProgressIndicator setIndeterminate:YES];
[_statusProgressIndicator setBackgroundColor:[NSColor clearColor]];
[_statusProgressIndicator setDrawsBackground:YES];
[_statusProgressIndicator startAnimation:self];

I also tried:

[_statusProgressIndicator setDrawsBackground:NO];

But it has the same effect.

Any ideas on how to fix this?

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370

1 Answers1

0

I downloaded the code and ran the sample, and there are no rounded corners present in the spinner provided by the original code.

I notice in your image that your view containing the spinner also has rounded corners? Are you using layer-backed views with the setCornerRadius: method?

If so, it looks like the spinner sub-view also has that property set, as it does looks like the spinner and your containing view have the same size rounded corners.

Try specifically setting the corner radius of the spinner view to 0?

Paige DePol
  • 1,121
  • 1
  • 9
  • 23
  • Hi, that's interesting. I'm using MDBorderlessWindow ( https://github.com/NSGod/BlackBorderlessWindow/ ) as the superView - it does: NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:frame xRadius:6.0 yRadius:6.0] but not much else. The spinner does: [NSBezierPath fillRect:[self bounds]]; - what should I change about that? –  Jan 26 '14 at 01:59
  • In the MDBorderlessWindow code change: `[NSBezierPath bezierPathWithRoundedRect:frame xRadius:6.0 yRadius:6.0]` to `[NSBezierPath bezierPathWithRoundedRect:self.frame xRadius:6.0 yRadius:6.0]` The `drawRect` routine in that function really should be naming the incoming parameter `rect` or `dirtyRect` not `frame`. When your spinners updates and the underlying window wants to update it is drawing the rounded corners in the dirty rect instead of only in the actual window frame. – Paige DePol Jan 26 '14 at 02:06
  • Also, on my system (10.9.1) that black borderless window has white corners where they should be transparent, also the window isn't moveable by clicking and dragging. – Paige DePol Jan 26 '14 at 02:10
  • thank you! That fixes it :-) Also, I do not get the white corners due to adding [self setBackgroundColor:[NSColor clearColor]]; in MDBorderlessWindow.m, and [self setMovableByWindowBackground:YES]; takes care of moving the window. –  Jan 26 '14 at 08:47
  • Ah nice, I was going to suggest both of those things, as that is what I am also doing for my rounded corner titleless splash screen! Glad I was able help, happy coding! :) – Paige DePol Jan 26 '14 at 08:49