zoukankan      html  css  js  c++  java
  • UIBezierPath的使用方法

    UIBezierPath的使用方式:

    一,直接添加轨迹,然后stroke或者fill

        UIColor *blue =[UIColor blueColor];

        

        [blue set];

        

        UIBezierPath *bezier =[UIBezierPath bezierPath];

        

        bezier.lineWidth=2;

        bezier.lineCapStyle=kCGLineCapRound;

        bezier.lineJoinStyle=kCGLineJoinRound;

        

        [bezier moveToPoint:CGPointMake(50, 5)];

        

        [bezier addLineToPoint:CGPointMake(90, 25)];

        [bezier addLineToPoint:CGPointMake(75, 50)];

        [bezier addLineToPoint:CGPointMake(25, 50)];

       

        [bezier closePath];

        

        [bezier fill];

    二,创建UIBezierPath对象,并将去path添加到layer上面

        UIBezierPath *bezier2 =[UIBezierPath bezierPathWithArcCenter:CGPointMake(50, 50) radius:20 startAngle:0 endAngle:M_PI clockwise:YES];

        

        CAShapeLayer *layer =[CAShapeLayer layer];

        layer.path=bezier2.CGPath;

        layer.strokeColor=[UIColor redColor].CGColor;

        layer.fillColor=[UIColor blueColor].CGColor;

        layer.borderWidth=1;

        

        

        [self.layer addSublayer:layer];

  • 相关阅读:
    Building fresh packages卡很久
    后端阿里代码扫描
    npm 使用淘宝镜像
    git镜像
    mysql安装8.0.18
    idea2019.2.2版本破解
    JDK下载很慢
    解决GitHub下载速度慢下载失败的问题
    Hashtable多线程遍历问题
    2-18 求组合数 注:代码有问题找不出哪儿错了
  • 原文地址:https://www.cnblogs.com/zhou--fei/p/4970406.html
Copyright © 2011-2022 走看看