I have an image which I would like to move around in a rail.
When I put my finger on it, i will only be able to move it up and down, and not from side to side. And how do I make them "stick" at either the top or the bottom? (or both)
Thanks.
I have an image which I would like to move around in a rail.
When I put my finger on it, i will only be able to move it up and down, and not from side to side. And how do I make them "stick" at either the top or the bottom? (or both)
Thanks.
Check out the answer(s) here - UIPanGestureRecognizer - Only vertical or horizontal
Just do this for the vertical pan gesture recognizer, it works for me:
- (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)panGestureRecognizer {
CGPoint translation = [panGestureRecognizer translationInView:someView];
return fabs(translation.y) > fabs(translation.x); }