Thursday, 8 August 2013

Detecting position tapped with UITapGestureRecognizer

Detecting position tapped with UITapGestureRecognizer

Hi so I was wondering if there was any way possible to get the position
that was touched using UITapGestureRecognizer to recognize taps on the
background.
-(void)handleTapGesture:(UITapGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateRecognized)
{
if ( bomb == nil)
{
bomb = [[UIImageView alloc] initWithImage:[UIImage
imageNamed:@"bomb.png"]];
bomb.center = CGPointMake(10, 1);
bomb.frame = CGRectMake(113,123,67,67);
[self.view addSubview:bomb];
//[self performSelector:@selector(Update) withObject:nil
afterDelay:1];
NSLog(@"Spawned bomb");
timer = [NSTimer scheduledTimerWithTimeInterval:.01 target:self
selector:@selector(dropBomb) userInfo:nil repeats:YES];
}
}
}

No comments:

Post a Comment