美文网首页
画矩形虚线

画矩形虚线

作者: FengxinLi | 来源:发表于2016-05-24 15:10 被阅读43次

CAShapeLayer *border = [CAShapeLayer layer];

//线的颜色

border.strokeColor = LineColor.CGColor;

border.fillColor = nil;

border.path = [UIBezierPath bezierPathWithRect:_dotLineView.bounds].CGPath;

border.lineWidth = 1.f;

border.lineCap = @"square";

//4是线的宽度  3是每条线的间距

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

[_dotLineView.layer addSublayer:border];

相关文章

网友评论

      本文标题:画矩形虚线

      本文链接:https://www.haomeiwen.com/subject/qtyzrttx.html