How do I use a different color for different border edges of a CALayer?
In order to draw a border around my UIView, I use the following code :
[_rectView.layer setBorderColor:[[UIColor blackColor] CGColor]];
[_rectView.layer setBorderWidth:1.0];
For one view, I would like to render only the right ed开发者_JAVA百科ge of my layer in black, the other 3 edges should be transparent.
How could I do that ?
You can use the CALayer's delegate to draw anything, including a black line on the right edge. I have had success with custom layer drawing in -drawLayer:inContext:.
精彩评论