【发布时间】:2015-01-22 19:48:31
【问题描述】:
我想使用带有 UIBezierPath 的 SKShapeNode 绘制一个圆形的填充扇区。 在大多数情况下,我的效果都很好,但是对于较小的角度,形状并没有完全填充(在弧线下方有一点间隙)。像这样:
这是我使用的代码:
CGPoint center = CGPointMake(500, 300) ;
UIBezierPath *bezierPath = [UIBezierPath bezierPath];
[bezierPath addArcWithCenter:center radius:400 startAngle:1.825777 endAngle:2.011118 clockwise:YES];
[bezierPath addLineToPoint:center];
[bezierPath closePath];
SKShapeNode *shapeNode = [SKShapeNode shapeNodeWithPath:bezierPath.CGPath];
shapeNode.strokeColor = [UIColor whiteColor];
shapeNode.fillColor = [UIColor whiteColor];
[self addChild:shapeNode];
iPad 和模拟器 (iOS 8.1) 上的结果相同。
是我做错了什么还是一些限制或错误?
如果无法使用这些 API 更准确地绘制此形状,您能否建议一些其他方法在 SpriteKit 游戏的上下文中绘制它。
提前谢谢你。
【问题讨论】:
标签: ios sprite-kit uibezierpath