touchesMoved 获取滑动的方向方法

来源:互联网 发布:山东直销软件开发 编辑:程序博客网 时间:2024/06/05 09:27
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{

      //怎样获取滑动的方向呢?


//通过pointptPrevious 的坐标判断 是向左向右 向下向上

    for (UITouch *touchin [event allTouches]) {

        if (touch.phase ==UITouchPhaseStationary) {

            continue;

        }

        CGPoint point=[touch locationInView:self];

        CGPoint ptPrevious=[touch previousLocationInView:self];



}