title: Drawing line with Touch iOS Sprite Kit
body: <p>Im using the following code to draw lines in my sprite kit scene but nothing shows up. But the node counts goes up. Can anyone see what could be the problem. Ive been fighting with this code forever</p>
  
  <pre><code>- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  {
      UITouch* touch = [touches anyObject];
      CGPoint positionInScene = [touch locationInNode:self];
  
      pathToDraw = CGPathCreateMutable();
      CGPathMoveToPoint(pathToDraw, NULL, positionInScene.x, positionInScene.y);
  
      lineNode = [SKShapeNode node];
      lineNode.path = pathToDraw;
      lineNode.strokeColor = [SKColor redColor];
      //lineNode.lineWidth = 2;
      [self addChild:lineNode];
  }
  
  - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
  {
      UITouch* touch = [touches anyObject];
      CGPoint positionInScene = [touch locationInNode:self];
      CGPathAddLineToPoint(pathToDraw, NULL, positionInScene.x, positionInScene.y);
      lineNode.path = pathToDraw;
  
  }
  
  - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
  {
  
    //  lineNode.physicsBody = [SKPhysicsBody bodyWithPolygonFromPath:pathToDraw];
    //  lineNode.physicsBody.dynamic = NO;
    //  lineNode.physicsBody.categoryBitMask = lines;
    //  lineNode.physicsBody.contactTestBitMask = 0;
    //  lineNode.physicsBody.collisionBitMask = blueParticles | redParticles| yellowParticles;
  
      CGPathRelease(pathToDraw);
  }
  </code></pre>
  
  <p><strong>Edit------ Code works when background node removed..How can I set up my background node so that I can daw overtop? Thanks</strong> </p>
  
  <pre><code>SKSpriteNode *background;
  
          if(screenHeight == 480){
              background = [SKSpriteNode spriteNodeWithImageNamed:@"iPhone4BG.png"];
          }
          if(screenHeight == 568){
              background = [SKSpriteNode spriteNodeWithImageNamed:@"iPhone5BG.png"];
          }
          if(screenHeight == 667){
              background = [SKSpriteNode spriteNodeWithImageNamed:@"iPhone6BG.png"];
          }
          if(screenHeight == 736){
              background = [SKSpriteNode spriteNodeWithImageNamed:@"iPhone6PlusBG.png"];
          }
  
          background.position = CGPointMake(screenWidth/2, screenHeight/2);
          background.size = CGSizeMake(screenWidth, screenHeight);
  
         // [self addChild:background];
  </code></pre>