标签:blog http color width 2014 art
1.
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(30, 30, 100, 100) cornerRadius:0];
CAShapeLayer * layer = [CAShapeLayer layer];
layer.path = path.CGPath;
layer.fillColor = [[UIColor blackColor]CGColor];
layer.strokeColor = [[UIColor orangeColor] CGColor];
[self.view.layer addSublayer:layer];
从下图可以看出,这个layer是一个矩形,那是因为 cornerRadius赋值为0
本文转自 张江论坛 张江家园网 http://www.999dh.net/home.php?mod=space&uid=1&do=blog&id=370 转载请注明
2.UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(30, 30, 100, 100) cornerRadius:0];修改为
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(30, 30, 100, 100) cornerRadius:30];后,得到的结果是
还可以通过
layer.lineCap = kCALineCapRound;
layer.lineWidth = 3.0f;
来指定stroke的宽度以及各式。
3 .[UIBezierPath bezierPathWithArcCenter:CGPointMake(100, 100) radius:50 startAngle:0 endAngle:2*3.14159 clockwise:YES];
是以 100,100为中心点,以50为半径,的一个圆(角度从0到2*PI) clockwise表示顺时针。
4.UIBezierPath * path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(100, 100) radius:50 startAngle:0 endAngle:3.14159 clockwise:NO];
CAShapeLayer * layer = [CAShapeLayer layer];
layer.path = path.CGPath;
layer.fillColor = [[UIColor blackColor]CGColor];
layer.strokeColor = [[UIColor orangeColor] CGColor];
layer.lineCap = kCALineCapRound;
layer.lineWidth = 3.0f;
[self.view.layer addSublayer:layer];
运行入下图
UIBezierPath * path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(100, 100) radius:50 startAngle:0 endAngle:3.14159 clockwise:NO];
从0到一个PI,方向是逆时针,所以就是上半个圆形。
UIBezierPath 贝塞尔曲线,布布扣,bubuko.com
标签:blog http color width 2014 art
原文地址:http://www.cnblogs.com/rollrock/p/3844768.html