I have a collectionviewcell cell
and I am adding a CAShapeLayer
to give my frontImageView
a half border. The code I have now successfully creates a half border but not where I want it. Setting stokeEnd=0.5
creates a half border on the bottom of my imageView. I would like the border to be on the right side of the imageView. From the top center to bottom center (right side).
Can I draw the stroke line from the top center of my imageView to the bottom center, along the right side?
CAShapeLayer *shape = [CAShapeLayer layer];
UIBezierPath *path=[UIBezierPath bezierPathWithOvalInRect:cell.frontImageView.frame];
[shape setPath:path.CGPath];
shape.strokeColor=[UIColor purpleColor].CGColor;
shape.fillColor=[UIColor clearColor].CGColor;
shape.lineWidth = 5.0f;
shape.lineCap = kCALineCapRound;
[shape setStrokeEnd:0.5];
[cell.layer addSublayer:shape];