手势拖动
UIPanGestureRecognizer * panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self
action:@selector(doMoveAction:)];
核心部分
拖到到前面还是后面的判断
Boolean preMove =true; //判断前后移动四种情况 //(ex<startPoint.x && ey<startPoint.y)||(ex>startPoint.x && ey<startPoint.y) ||(ex==startPoint.x && ey<startPoint.y)
|| (ey==startPoint.y && ex <startPoint.x) //偏差5都认为相等 CGFloat diff =10; if ((startPoint.x-ex>diff && startPoint.y-ey>diff)||(ex>(startPoint.x+diff) && (ey+diff)<startPoint.y)
||(fabs(ex-startPoint.x)<=diff && (ey+diff)<startPoint.y)|| (fabs(ey-startPoint.y)<=diff && (ex+diff) <startPoint.x) )