3

I'm on OSX, XCode 8.2, Objective-C

I have a window with a background Image:

self.window.titleVisibility = NSWindowTitleHidden;
self.window.titlebarAppearsTransparent = YES;
self.window.styleMask |= NSFullSizeContentViewWindowMask;
self.window.movableByWindowBackground = YES;
self.window.opaque = NO;       
self.window.backgroundColor = [NSColor colorWithPatternImage:[NSImage imageNamed:@"background.jpg"]]];

In that window i have an NSTabViewController. On one of those NSTabViews i draw an NSView with rounded corners:

- (id)initWithFrame:(NSRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.layer = _layer;   // strangely necessary
        self.wantsLayer = YES;
        self.layer.masksToBounds = YES;
        self.layer.cornerRadius = 10.0;
    }
    return self;
}

My Problem is that even if the corners are round, there's still that bright white corner visible.

enter image description here

The answer here (rounded corners on NSView using NSBezierPath are drawn badly) didn't work for me because i have a background image - although it works WITHOUT background image. But i'd like to keep that image because the window is then draggable by clicking its background.

I also tried to use an NSImageView for my background image, move it to the back and override it's mouseDownCanMoveWindow method. That works too for the dragging, but still not for the corner drawing.

Any help appreciated

Community
  • 1
  • 1
Pat_Morita
  • 3,355
  • 3
  • 25
  • 36
  • It looks to me like you're just seeing the window (or some other view) *behind* the view with the rounded corner. If you want everything rounded, then you probably need to round one of your outermost container views instead of specific "leaf" subviews. – Aaron Golden Apr 13 '17 at 12:39
  • I already wrote that it WORKS without the background image in the NSWindow. So there's nothing behind - i also checked that technically. – Pat_Morita Apr 13 '17 at 13:28

0 Answers0