首页 > 代码库 > 判断某个点是否在某个view上

判断某个点是否在某个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");

    }

}

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