My project based on touch event in scrollview. im using the following code but it shows an error. gesture undeclared. how to declare gesture please tell me,
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapGestureCaptured:)];
[scrollView addGestureRecognizer:sing开发者_运维问答leTap];
- (void)singleTapGestureCaptured:(UITapGestureRecognizer *)touch
{
CGPoint touchPoint=[gesture locationInView:scrollView];
}
Sorry I didn't look at your code carefully
CGPoint touchPoint=[touch locationInView:scrollView];
use this.
You dont have any variable named gesture.
You need to declare an UITouch object for that.
UITouch *gesture;
Beacause you can pass the locationInView method only to UITouch class objects.Otherwise it will throw an error.
精彩评论