Harkonnen
Harkonnen

Reputation: 813

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 edge of my layer in black, the other 3 edges should be transparent.

How could I do that ?

Upvotes: 0

Views: 290

Answers (1)

Richard
Richard

Reputation: 3386

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

Upvotes: 1

Related Questions