ios判断点击的坐标点

 

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

{

    NSSet *allTouches = [event allTouches];    //返回与当前接收者有关的所有的触摸对象

    UITouch *touch = [allTouches anyObject];   //视图中的所有对象

    CGPoint point = [touch locationInView:[touch view]]; //返回触摸点在视图中的当前坐标

    int x = point.x;

    int y = point.y;

    

    if(y<self.frame.size.height - 500)

    {

        [self removeFromSuperview];

    }

}

原文地址:https://www.cnblogs.com/xiangjune/p/5016145.html