user3339697
user3339697

Reputation:

drawRect in SKScene

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!

Upvotes: 2

Views: 879

Answers (1)

CodeSmile
CodeSmile

Reputation: 64477

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];

Upvotes: 3

Related Questions