2

I am trying to use a UIBezier path for drawing a line using user touch. I have the physics body and bezier working separately although I need to merge them together. Is there a way to implement drawRect or an equivalent within SpriteKit? Thanks in advance!

1 Answers1

3

Nope. DrawRect or other custom drawing methods are not (currently) supported by Sprite Kit. Use SKShapeNode to draw the path.

SKShapeNode* shape = [SKShapeNode node];

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

shape.path = path;
[self addChild:shape];
LearnCocos2D
  • 64,083
  • 20
  • 128
  • 214