I have a 30x30 view which is rounded:
CALayer * layer = self.layer;
layer.backgroundColor = [NSColor redColor].CGColor;
layer.cornerRadius = 10.0f;
layer.masksToBounds = YES;
Then I add a sublayer, like so:
CALayer * subLayer = [CALayer layer];
subLayer.backgroundColor = [NSColor yellowColor].CGColor;
subLayer.frame = CGRectMake(0.0f, 0.0f, 10.0f, 10.0f);
[layer addSublayer:subLayer];
And I end up with this, which is not what I want!
This is a problem that has only surfaced since my upgrade to El Capitan. In Yosemite the masking worked for the above code. What am I missing?
Update: this issue does not occur when I set layer.shouldRasterize = YES;
however I want to keep memory down so I would prefer another solution.