美文网首页
UIBezierPath不规则图形小记

UIBezierPath不规则图形小记

作者: 有理想有暴富的小青年 | 来源:发表于2019-12-14 11:20 被阅读0次

  UIBezierPath *path = [UIBezierPath bezierPath];

        CGFloatvh =Get375Height(56);

        [pathmoveToPoint:CGPointMake(0, 0)];

        [pathaddLineToPoint:CGPointMake(0, vh)];

        [pathaddLineToPoint:CGPointMake(kScreenWidth, vh)];

        [pathaddLineToPoint:CGPointMake(kScreenWidth, vh/3*2)];

        [pathaddQuadCurveToPoint:CGPointMake(kScreenWidth - 100, vh) controlPoint:CGPointMake(kScreenWidth, vh)];

        [pathaddQuadCurveToPoint:CGPointMake(0, 0) controlPoint:CGPointMake(kScreenWidth/5, vh)];

        CAShapeLayer*shapLayer = [CAShapeLayerlayer];

        shapLayer.path= path.CGPath;

        self.bezierView.layer.mask= shapLayer;

[self.view addsubview : self.bezierView];

注解:        [pathaddQuadCurveToPoint:CGPointMake(0, 0) controlPoint:CGPointMake(kScreenWidth/5, vh)];

CurveToPoint是终点  起点在上一个终点   controlPoint是起点和终点的弧度的最高点或是最低点(个人是这样理解的)

大概就这样

相关文章

网友评论

      本文标题:UIBezierPath不规则图形小记

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