iOS-开发菜鸟->大神开发

iOS touchesBegan判断点击在哪个view中

2017-06-15  本文已影响32人  e5311f1a36e5

简单说明:

代码

- (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;
    }
}
上一篇 下一篇

猜你喜欢

热点阅读