Iphone 如何从UITextview涵盖的UIScrollview获取点击位置

Iphone 如何从UITextview涵盖的UIScrollview获取点击位置,iphone,uiscrollview,location,uitextview,tap,Iphone,Uiscrollview,Location,Uitextview,Tap,大家好 我有一个textview作为scrollview的子视图,textview覆盖了scrollview的所有区域。 我想在scrollview中点击位置,但textview没有通过 这种情况是,如果我点击textview,也会在scrollview中检测到点击。 我可以这样做吗 这是我的实现: -(void)viewWillAppear:(BOOL)animated{ UIGestureRecognizer *tapScroll = [[UITapGestureRecognizer

大家好

我有一个textview作为scrollview的子视图,textview覆盖了scrollview的所有区域。 我想在scrollview中点击位置,但textview没有通过 这种情况是,如果我点击textview,也会在scrollview中检测到点击。 我可以这样做吗

这是我的实现:

-(void)viewWillAppear:(BOOL)animated{   
UIGestureRecognizer *tapScroll = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
//tapScroll.numberOfTapsRequired = 2;
[self.scrollView addGestureRecognizer:tapScroll];

self.tapGesture = (UITapGestureRecognizer *)tapScroll;
tapScroll.delegate = self;

[tapScroll release];
}

-(void)handleTap:(UITapGestureRecognitor*)识别器{
NSLog(“手柄分接头”);
位置=[识别器位置视图:self.scrollView];
[self.textView成为第一响应者];
NSLog(@“位置点击x:%f,y:%f”,位置x,位置y);
if(location.y
}


我无法获取点击位置,因为textview没有通过它,有人能帮我吗???

将UITextView子类化并覆盖它

- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view

教程

我已经这么做了,但是文本视图仍然没有通过手势,你能告诉我怎么做吗?
- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view