Gray border when using NSBorderlessWindowMask

Whenever I try to create a custom window using NSBorderlessWindowMask and set the NSView (e.g. NSImageView) as its content, I get a 1px gray series around the NSView and I can't seem to get rid of it.

I have followed several approaches, including the Apple RoundTransparentWindow sample code, as well as several StackOverflow suggestions.

I suspect that the gray frame either exits from the window itself or from NSView.

Do any of you have this problem or do you have a possible solution?

The code is pretty simple. This is the init method of the user window:

- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag {
    self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];

    if (self != nil) {
        [self setAlphaValue:1.0];
        [self setBackgroundColor:[NSColor clearColor]];     
        [self setOpaque:NO];
    }

    return self;
}

, IB NSImageView WITHOUT border, NSImageView . NSView, NSTextField, NSTableView.

, , (RoundTransparentWindow) Apple. NSView 1px?

+3
1

, , NSView ? , . (, NSImageView) . , , , .

. ? . ( ) , . .

+1

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


All Articles