我有三个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 上实际可以看到的视图?