2

I have a UIView on which I have added PanGestureRecognizer, My UI will behave like panning and after end of pan gesture it should continue to move on that direction with some deceleration. Which I have done. I show deceleration by a block

[UIView animateWithDuration:slideFactor*2
                      delay:0
                    options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction
                 animations:^{
                     _movieView.center = finalPoint;
               } completion:nil];

Now during animation if it recognizes another touch or tap or pan, It should stop at that point. So, that further panning can be done.

My selector method for PanGestureRecognizer is doing something like this.

if ([panGesture state] == UIGestureRecognizerStateChanged)
{
    [self mpvGestureStateBeginOrChanged:panGesture];
}
if ([panGesture state] == UIGestureRecognizerStateEnded)
{
    [self mpvGestureStateEnd:panGesture];
}
if ([panGesture state] == UIGestureRecognizerStateBegan) 
{
    [self.view.layer removeAllAnimations];
    // It stops at the final end position of the view
    // I want to stop animation right at the this point.
}

Note Due to some restrictions of UI, I can't use UIScrollView. Kindly suggest me something or solve the problem

David Rönnqvist
  • 56,267
  • 18
  • 167
  • 205
umirza47
  • 940
  • 2
  • 10
  • 21
  • Please view this Question asked in this thread http://stackoverflow.com/questions/12890345/when-a-uibutton-is-animating-i-want-to-recognize-a-event-on-the-button/12890530#12890530. – Kamar Shad Oct 15 '12 at 07:50
  • Thanks, I have read that but found no solution – umirza47 Oct 15 '12 at 09:04
  • 1
    just check what gesture youa ree adding to your button, i think you are adding Pangesture , just add Tapgesture or LongPrssGesture and One Thing you will have to change the animation option use `UIViewAnimationOptionAllowUserInteraction` – Kamar Shad Oct 15 '12 at 09:22
  • it sounds like you're just re-implementing UIScrollView. Is this intentional? – jackslash Oct 15 '12 at 10:57
  • Almost, With some more additional things that I have added into it, Just stuck with this thing, and everything else is already done. – umirza47 Oct 16 '12 at 04:56

0 Answers0