1

我有三个UIView实例:

UIView *view1;
UIView *view2;
UIView *view3;

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

 UITouch *touch =[touches anyObject];
 CGPoint startPoint =[touch locationInView:self.view];

}

但我希望 toch-action 只在 view2 中进行。如果我制作它不起作用:locationInView:view2

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

 UITouch *touch =[touches anyObject];
 CGPoint startPoint =[touch locationInView:view2];

}

我错了什么?我如何检查,哪个视图是我在 iphone 上实际可以看到的视图?

4

1 回答 1

1

在您不希望处理触摸的视图中将 userInteractionEnabled 设置为 false。

于 2011-02-24T08:57:47.307 回答