Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question