我有三个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上可以看到的视图?
答案 0 :(得分:1)
在您不希望处理触控的视图中将userInteractionEnabled设置为false。