判断点击在哪个view中
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
CGPoint point = [[touches anyObject] locationInView:self.view];
point = [self.subView1.layer convertPoint:point fromLayer:self.view.layer];
if ([self.subView1.layer containsPoint:point]) {
//处理点击到这个view中要执行的事件
return;
}
}
网友评论