IOS仿桌面拖动桌面图标
手势拖动
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) )
--------------------------------------------------------------------------------------------------------------------------------------------
作者:Honey_Badger —— 觉得这文章好,点一下左下角
出处:http://tk55.cnblogs.com/
posted on 2020-06-05 17:52 Honey_Badger 阅读(577) 评论(0) 编辑 收藏 举报