触摸仅在特定UIView中开始
我有三个触摸仅在特定UIView中开始,uiview,location,touchesbegan,Uiview,Location,Touchesbegan,我有三个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的动作只出现在view2中。如果我使
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的动作只出现在view2中。如果我使用:locationInView:view2,它将不起作用
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch =[touches anyObject];
CGPoint startPoint =[touch locationInView:view2];
}
我错了什么?如何检查,我在iphone上实际可以看到的视图是哪个视图?在不希望触摸的视图中将userInteractionEnabled设置为false。在不希望触摸的视图中将userInteractionEnabled设置为false