0
votes

In iOS 7 to make a button is Spritekit we create an SKLabelNode and on the TouchesBegan delegate function we create an SKNode on the touch position and check the name of the node if it is equal to the name of the sklabelnode intended. But in iOS 8 we are have a problem, we are using the same concept but the SKNode's position is always 0! So what's wrong?!

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
   for (UITouch *touch in touches)
   {
       CGPoint touchLocation = [touch locationInNode:self];
       SKNode *n = [self nodeAtPoint:touchLocation];
       NSLog(@"Node Position: %f, %f", n.position.x, n.position.y);
   }
}
1

1 Answers

0
votes

Solved by changing this:

if (n != self && [n.name isEqual: @"restartLabel"])

to this:

if([restartLabel containsPoint:touchLocation])