I am using iOS 5.x SDK and I want to determine if the screen has been tapped
For now just putting up an NSLog is fine but I don't know where to start
Generally with gesture recognizers , eg,
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOnView:)];
[self.view addGestureRecognizer:tap];
You then have a method like:
- (void)tapOnView:(UITapGestureRecognizer *)sender
{
CGPoint location = [sender locationInView:self.view];
NSLog(@"Tap at %1.0f, %1.0f", location.x, location.y);
}
You might want to start with implementing touchesBegan:withEvent:
, touchesMoved:withEvent:
, touchesEnded:withEvent:
, touchesCancelled:withEvent:
.
You can read more about it here: UIResponder Class Reference
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.