画虚线边框

来源:互联网 发布:电视控软件 编辑:程序博客网 时间:2024/05/16 12:26

CAShapeLayer *border = [CAShapeLayer layer];

border.strokeColor = SLColorLine.CGColor;

border.fillColor = nil;

border.path = [UIBezierPath bezierPathWithRect:self.bounds].CGPath;
//border.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:CGRectGetWidth(self.bounds)/2].CGPath;

border.frame = self.bounds;

border.lineWidth = 1.f;

border.lineCap = @”square”;

border.lineDashPattern = @[@4, @2];

[self.layer addSublayer:border];

0 0
原创粉丝点击