首页 > 其他 > 详细

使用CAShapeLayer画视图尖角

时间:2016-08-23 18:35:37      阅读:172      评论:0      收藏:0      [点我收藏+]

x y z 分别是尖角的三个顶点的x坐标,从左到右排列      后面的[UIScreen mainScreen].bounds.size.height -65 是y坐标  与x坐标一一对应

- (void)shapeChange:(int)x Pointy:(int)y Pointz:(int)z{

    /*形状*/

    self.shapeLayer = [CAShapeLayer layer];

    //self.shapeLayer.strokeColor = [UIColor greenColor].CGColor;

    self.shapeLayer.fillColor = [UIColor whiteColor].CGColor;

    self.shapeLayer.lineWidth = 1;

    /*路径*/

    CGMutablePathRef path = CGPathCreateMutable();

    CGPathMoveToPoint(path, NULL,x ,[UIScreen mainScreen].bounds.size.height -65);

    CGPathAddLineToPoint(path, NULL, y, [UIScreen mainScreen].bounds.size.height -53);

    CGPathAddLineToPoint(path, NULL, z, [UIScreen mainScreen].bounds.size.height -65);

    self.shapeLayer.path = path;

    self.shapeLayer.frame = self.heatab

    .view.bounds;

        [self.bgview.layer addSublayer:self.shapeLayer]; 

}

使用CAShapeLayer画视图尖角

原文:http://www.cnblogs.com/Jusive/p/5800354.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!