开发者

How do I use a different color for different border edges of a CALayer?

开发者 https://www.devze.com 2023-02-03 09:23 出处:网络
In order to draw a border around my UIView, I use the following code : [_rectView.layer setBorderColor:[[UIColor blackColor] CGColor]];

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:.

0

精彩评论

暂无评论...
验证码 换一张
取 消