How to remove the white square around my NSProgressIndicator?

I am adding NSProgressIndicator to my NSMenuItem (with custom view). It works fine, but around it has a weird square:

White square around progress indicator

Here is my code:

// In my @interface declaration:
NSProgressIndicator *_spinner;

...

// In initWithFrame:
_spinner = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0, 0, 20, 20)];
[_spinner setBezeled:NO];
[_spinner setTranslatesAutoresizingMaskIntoConstraints:NO];
[_spinner setControlSize:NSMiniControlSize];
[_spinner setStyle:NSProgressIndicatorSpinningStyle];
[_spinner sizeToFit];
[self addSubview:_spinner];

I do not know why this is happening. Somebody knows?

Thank.

+4
source share
2 answers

I also faced the same problem. The problem is not in the progress indicator, but in the appropriate monitoring of the progress indicator.

Decision,

"" " ". .


Send this image

+2

[_spinner setOpaque:NO];
[_spinner setBackgroundColor:[NSColor clearColor]];
-3

Source: https://habr.com/ru/post/1543914/


All Articles