Problems with CGPoint in touches event

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2010-06-11T01:31:21Z Indexed on 2010/06/11 1:32 UTC
Read the original article Hit count: 347

Filed under:
|
|

I'm having some problems with storing variables from my touch events. The warning I get when I run this is that coord and icoord are unused, but I used them in the viewDidLoad implementation, is there a reason why this does not work? Any suggestions?

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    UITouch *touch = [[event allTouches] anyObject];
    CGPoint icoord = [touch locationInView:touch.view];

}


-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [[event allTouches] anyObject];
    CGPoint coord = [touch locationInView:touch.view];  

}

- (void)viewDidLoad {

    if (coord.x > icoord.x) {
    player.center = CGPointMake(player.center.x + 5, player.center.y);
    }

}

Thanks.

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about touch