I only managed to do so If I set cornerRadius property to the layer I want to mask.
I am trying to achieve:
- UIView that is whole blue.
- CALayer with full background color red.
- maskLayer, CALayer which is smaller than the first one (CGRectInset(redLayer.frame, 20, 20))
- redLayer.mask = maskLayer
[blueView.layer addSublayer:redLayer]
Now I would like to have only red border (redLayer) and middle would be blue (because blueView is blue). This blue part is size/shape of maskLayer (and is transparent so thats why I should see blue color).
Am I on a right track here?
maskLayermust have some color set on it.