判断某个点是否在某个view上

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

{

    UITouch *touch = [touches anyObject];

    CGPoint pt = [touch locationInView:self.view];

    

    if (!CGRectContainsPoint([self.view frame], pt)) {

        NSLog(@"pt不在self.view");

    }else{

        NSLog(@"ptself.View");

    }

}

原文地址:https://www.cnblogs.com/mgbert/p/4093232.html