我使用以下代码显示三角视图之类的指针,如下图所示。
UIView *triangleView = [[UIView alloc] initWithFrame:CGRectMake(70.0f,58.0f, self->_createAccountView.frame.size.width ,20.0f)];
UIBezierPath* trianglePath = [UIBezierPath bezierPath];
[trianglePath moveToPoint:CGPointMake(0, 0)];
[trianglePath addLineToPoint:CGPointMake((self->_createAccountView.frame.size.width/7) -8, (self->_createAccountView.frame.size.height/4))];
[trianglePath addLineToPoint:CGPointMake((self->_createAccountView.frame.size.width/5) , 0)];
[trianglePath closePath];
trianglePath.lineJoinStyle = kCGLineJoinRound;
CAShapeLayer *triangleMaskLayer = [CAShapeLayer layer];
[triangleMaskLayer setPath:trianglePath.CGPath];
triangleView.backgroundColor = [UIColor colorWithRed:1.00 green:1.00 blue:1.00 alpha:1.0];
triangleView.layer.mask = triangleMaskLayer;
[self->_AccountView addSubview:triangleView];
这很好但我希望三角形视图的指向边缘是圆形的。如何使它圆润?任何帮助表示赞赏!
答案 0 :(得分:0)
将lineJoin
更改为kCALineJoinRound
。
triangleMaskLayer.lineJoin = kCALineJoinRound;