Get historcial points ios

2019-09-06 16:54发布

问题:

Is there any function or algorithm to catch all the points when drawing in iPhone? Like in Android, where we have gethistoical points.

回答1:

Check the methods touchesBegan:withEvent:, touchesMoved:withEvent:, touchesEnded:withEvent: and touchesCancelled:withEvent: to detect movements

For example using the method -touchesMoved:withEvent:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint currentPosition = [touch locationInView:self.view];
    NSLog(@"%@", NSStringFromCGPoint(currentPosition));
}

For more info check the documentation of the UIResponder class