drawRect in SKScene

时间:2014-07-10 20:58:20

标签: sprite-kit drawrect uibezierpath

我正在尝试使用UIBezier路径使用用户触摸绘制线条。虽然我需要将它们合并在一起,但我有物理体和贝塞尔分开工作。有没有办法在SpriteKit中实现drawRect或等效?提前谢谢!

1 个答案:

答案 0 :(得分:3)

不。 Sprite Kit(目前)不支持DrawRect或其他自定义绘图方法。使用SKShapeNode绘制路径。

SKShapeNode* shape = [SKShapeNode node];

CGMutablePathRef path = CGPathCreateMutable();
// create your path here ...

shape.path = path;
[self addChild:shape];