Thanks for aฤรข , I found a solution.
- Basically a border is always drawn on top of everything
What I've done:
- Create a UIView with a border color
- Create another UIView as a child of the UIView, which is slightly smaller than the first. The color of this newly created UIView is the primary color.
Here is the code:
self.layer.cornerRadius = 15; self.layer.masksToBounds = YES; self.backView.layer.cornerRadius = 15; self.backView.layer.masksToBounds = YES;
Result:

This is more or less what I need, although it is not perfect.
Zhou hao
source share