Rounded rect on NSView that clips all containing subviews
问题 I am creating a NSView subclass that has rounded corners. This view is meant to be a container and other subviews will be added to it. I am trying to get the rounded corners of the NSView to clip all of the subview's corners as well, but am not able to get it. - (void)drawRect:(NSRect)dirtyRect { NSRect rect = [self bounds]; NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:self.radius yRadius:self.radius]; [path addClip]; [[NSColor redColor] set]; NSRectFill(dirtyRect