ios ----- 判断触摸点是否在某个视图内

2017-07-24  本文已影响838人  lizhi_boy
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    CALayer *testViewLayer = self.testView.layer.presentationLayer;
    CGPoint touchPoint = [[touches anyObject] locationInView:self.view];
    if (CGRectContainsPoint(testViewLayer.frame, touchPoint)) {
        NSLog(@"触摸点在视图内");
    }
}
上一篇 下一篇

猜你喜欢

热点阅读