What i need to do is to add a View and then have a single Tap Recognizer where when the user taps on the screen, then a NSLog will be displayed;
This is what i did;
I added the UIGestureRecognizerDelegate to my .h file. and in the .m i wrote the following code
UIView* view1 = [[UIView alloc] initWithFrame:
[[UIScreen mainScreen] applicationFrame]];
UIGestureRecognizer *one= [[UIGestureRecognizer alloc] initWithTarget:self action:@selector(onetapmethod:)];
[one setDelegate:self];
[one setDelaysTouchesBegan:YES];
[view addGestureRecognizer:one];
I am doing this according to a tutorial, and according to the tutorial i will have to add setNumberOfTaps:1 but when it says that the setter method is not found.
Why is this ?
and how can i edit my code for this to work ?
Is my code correct ? (adding the gestureRecogniser to view [view addGestureRecognizer:one];) ?
You should use UITapGestureRecognizer instead of UIGestureRecognizer.