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!
Asked
Active
Viewed 874 times
1 Answers
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];

CodeSmile
- 64,284
- 20
- 132
- 217
-
1If you know how to make a diagonal SKShapeNode line then that solves the problem. Thanks for the start! – Jul 11 '14 at 00:43
-
@TimothySwan what do you mean? Are you trying to put objective-c code into swift?? – MeV May 08 '15 at 11:50
-
Right. I finally realize that was the issue after making some corrections. – Timothy Swan May 08 '15 at 16:17