美文网首页iOS开发iOS 菜鸟之旅
使用UIBezierPath,CAShapeLayer画虚线

使用UIBezierPath,CAShapeLayer画虚线

作者: 涛涛灬灬 | 来源:发表于2017-07-20 17:52 被阅读63次

    UIBezierPath *path = [UIBezierPath bezierPath];
    [path moveToPoint:CGPointMake(0, 0)];
    [path addLineToPoint:CGPointMake(self.width-30, 0)];

    _shapeLine = [CAShapeLayer layer];
    _shapeLine.frame = CGRectMake(15, self.bottom - 1, self.width-30, 0.5);
    _shapeLine.lineJoin = kCALineJoinRound;
    _shapeLine.lineDashPattern = @[@(5),@(5)];
    _shapeLine.fillColor = [UIColor clearColor].CGColor;
        _shapeLine.strokeColor = kCYTCardLineColor.CGColor;
    _shapeLine.path = path.CGPath;
    [self.layer addSublayer:_shapeLine];

    相关文章

      网友评论

      本文标题:使用UIBezierPath,CAShapeLayer画虚线

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