Tag: cashapelayer

UIBezierPath带有圆边的三angular形

我devise了这个代码来生成一个Bezierpath,用作CAShapeLayer的path来掩盖UIView(视图的高度和宽度都是可变的) 这段代码会生成一个尖锐的三angular形,但是我想把它变成圆angular。 我花了好2个小时试图与addArcWithCenter… , lineCapStyle和lineJoinStyle等工作,但似乎没有为我工作。 UIBezierPath *bezierPath = [UIBezierPath bezierPath]; CGPoint center = CGPointMake(rect.size.width / 2, 0); CGPoint bottomLeft = CGPointMake(10, rect.size.height – 0); CGPoint bottomRight = CGPointMake(rect.size.width – 0, rect.size.height – 0); [bezierPath moveToPoint:center]; [bezierPath addLineToPoint:bottomLeft]; [bezierPath addLineToPoint:bottomRight]; [bezierPath closePath]; 所以我的问题是,我将如何绕过UIBezierPath中的三angular形的所有边缘(我是否需要子层,多个path等)? 注意我没有绘制这个BezierPath,所以所有CGContext…函数drawRect不能帮助我:( 谢谢!