M
M
Max Onflic2014-09-15 11:57:01
iPhone
Max Onflic, 2014-09-15 11:57:01

How to catch UITouch movement?

The matter is that I build an ellipse by means of Core Graphics. Here is part of the code. Everything is built up to the moment when 2 fingers freeze on the screen (I build according to the coordinates of the fingers). What method will be called when the finger stops on the screen or how to catch it?

if (touches.count == 2) {
            
        NSArray *sortedTouches = [touches allObjects];
            
            if (sortedTouches.count==2) {
                
            
        UITouch *touch1 = [sortedTouches objectAtIndex:0];
        UITouch *touch2 = [sortedTouches objectAtIndex:1];
        CGPoint currentPoint1 = [touch1 locationInView:drawImage.superview];
        
        CGPoint currentPoint2 = [touch2 locationInView:drawImage.superview];
        
        CGPoint one=currentPoint1;//[touch previousLocationInView:self.drawImage];
        CGPoint two=currentPoint2;//[touch locationInView:self.drawImage];
        
              //  CGRect rectangle = CGRectMake(one.x, one.y, two.x, two.y);
        
            
                
               // CGContextAddEllipseInRect(UIGraphicsGetCurrentContext(), rectangle);
            
            sortedTouches=nil;
                
                }
        }
      else if (touches.count > 2)
      {
          drawImage.image=nil;
      
      }
        
    
    
    }
    
    
   // FirstPoint=lastPoint;
   // endPoint=currentPoint;
    
   CGContextStrokePath(UIGraphicsGetCurrentContext());
    
    drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
    
    UIGraphicsEndImageContext();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Max Onflic, 2014-09-15
@maxonflic

UITouchPhaseStationary

V
Vanya Ivanov, 2015-01-04
@mr_cloud

https://vk.com/videos-58860049?section=search&z=vi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question