i tried a few hours to get a dotted border around my UIView with CAShapeLayer but i don\'t get it displayed.
ScaleOverlay.h
#import
You never add shapeLayer
as a sublayer of your UIView's layer, so it's never displayed onscreen. Try adding
[self.layer addSublayer:shapeLayer_];
after you set up your CAShapeLayer in your -initWithFrame:
method.
Even better, you could try making your UIView's backing layer a CAShapeLayer by overriding the following class method:
+ (Class) layerClass
{
return [CAShapeLayer class];
}
You could then deal with the view's layer directly, and eliminate the additional CAShapeLayer instance variable.