开发者

touch action in scroll view

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜