You have basically two approaches:
subclass UIScrollView and override touchesBegan/Moved/Ended ;
add your own UIPanGestureRecognizer to your current UIScrollView .
set a timer, and every time it fires, refresh the display of your view _scrollview.contentOffset.x ;
In the first case, you will use touch processing methods:
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { UITouch* touch = [touches anyObject]; _initialLocation = [touch locationInView:self.view]; _initialTime = touch.timestamp; <more processing here>
I am sure you need to do this for touchesMoved ; I donβt know if you need something concrete when the gesture begins or ends; in this case also override touchesMoved: and touchesEnded: Also think about touchesCancelled:
In the second case, you would do something like:
The third case is pretty trivial to implement. Not sure if this will give better results than the other two.
source share