美文网首页iOS DeveloperiOS开发
iOS开发小常识之设置小页面上的三角形

iOS开发小常识之设置小页面上的三角形

作者: 提莫酱T | 来源:发表于2017-03-21 15:18 被阅读0次

// 画三角形19 143 83

UIBezierPath *path = [UIBezierPath bezierPath];

[path moveToPoint:CGPointMake(width - 25, 10)];

[path addLineToPoint:CGPointMake(width - 20, 2)];

[path addLineToPoint:CGPointMake(width - 15, 10)];

CAShapeLayer *layer = [CAShapeLayer layer];

// 颜色设置和cell颜色一样

layer.fillColor = [UIColor redColor].CGColor;

layer.strokeColor = [UIColor blueColor].CGColor;

//    layer.fillColor = RGBCOLOR(19, 143, 83, 1).CGColor;

//  layer.strokeColor = RGBCOLOR(19, 143, 83, 1).CGColor;

layer.path = path.CGPath;

[self.bgView.layer addSublayer:layer];

这里的bgView是我的背景View

相关文章

网友评论

    本文标题:iOS开发小常识之设置小页面上的三角形

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