今天主要讲解图层的lineJoin miterLimit 属性。
lineJoin 连接点类型,对应曲线节点的显示样式。可能会受到miterLimit影响。看四个例子

CAShapeLayer * Star = [CAShapeLayer layer];
Star.frame = CGRectMake(102, 254.56, 183.74, 193.44);
Star.lineCap = kCALineCapRound;
Star.lineJoin = kCALineJoinMiter;
Star.miterLimit = 4;
Star.fillColor = [UIColor colorWithRed:0.847 green: 0.847 blue:0.847 alpha:1].CGColor;
Star.strokeColor = [UIColor colorWithRed:0.592 green: 0.592 blue:0.592 alpha:1].CGColor;
Star.lineWidth = 15;

CAShapeLayer * Star = [CAShapeLayer layer];
Star.frame = CGRectMake(102, 254.56, 183.74, 193.44);
Star.lineCap = kCALineCapRound;
Star.lineJoin = kCALineJoinRound;
Star.fillColor = [UIColor colorWithRed:0.847 green: 0.847 blue:0.847 alpha:1].CGColor;
Star.strokeColor = [UIColor colorWithRed:0.592 green: 0.592 blue:0.592 alpha:1].CGColor;
Star.lineWidth = 15;
Star.path = [self StarPath].CGPath;

CAShapeLayer * Star = [CAShapeLayer layer];
Star.frame = CGRectMake(102, 254.56, 183.74, 193.44);
Star.lineCap = kCALineCapRound;
Star.lineJoin = kCALineJoinBevel;
Star.fillColor = [UIColor colorWithRed:0.847 green: 0.847 blue:0.847 alpha:1].CGColor;
Star.strokeColor = [UIColor colorWithRed:0.592 green: 0.592 blue:0.592 alpha:1].CGColor;
Star.lineWidth = 15;
Star.path = [self StarPath].CGPath;

CAShapeLayer * Star = [CAShapeLayer layer];
Star.frame = CGRectMake(102, 254.56, 183.74, 193.44);
Star.lineCap = kCALineCapRound;
Star.lineJoin = kCALineJoinMiter;
Star.miterLimit = 1;
Star.fillColor = [UIColor colorWithRed:0.847 green: 0.847 blue:0.847 alpha:1].CGColor;
Star.strokeColor = [UIColor colorWithRed:0.592 green: 0.592 blue:0.592 alpha:1].CGColor;
Star.lineWidth = 15;
Star.path = [self StarPath].CGPath;
网友评论