How to effectively process UITouches in a multitouch sequence

后端 未结 2 1700
太阳男子
太阳男子 2020-12-04 00:29

I am working with multitouch while writing, So basically what I am doing is, I am writing with hand support, because typically, its how user writes, I followed this link How

2条回答
  •  温柔的废话
    2020-12-04 01:02

    I finally solved my issue,

    Here is the code

    -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        UITouch* topmostTouch = self.trackingTouch;
        for (UITouch *touch in touches)
        {
    
    
            touchStartPoint1 = [touch locationInView:self];
    
    
            if(!topmostTouch || [topmostTouch locationInView:self].y > touchStartPoint1.y)
            {
                ctr = 0;
                topmostTouch = touch;
                pts[0] = touchStartPoint1;
            }
        }   
    
        self.trackingTouch = topmostTouch;
    }
    

    The problem was very simple, just set ctr = 0 , inside the check, like this..

提交回复
热议问题