1

using UIPanGestureRecognizer we are moving the cells in the UICollectionView

When we started dragging UIGestureRecognizerStateBegan is called. but when we still holds the dragging cell and presses the Home Button in ipad, the UIPanGestureRecognizer not calling UIGestureRecognizerStateEnded or UIGestureRecognizerStateFailed or UIGestureRecognizerStateCancelled, not even calling gesture method

- (void)handlePanGesture:(UIPanGestureRecognizer *)gestureRecognizer;

When i opened my app from background the cell is at the same place in the view but am not able to perform any actions on it. this is because of UIPanGestureRecognizer not calling the gestureStates.

How to end my UIPanGestureRecognizer when user presses the home button.

Konda
  • 123
  • 1
  • 10
  • Did you try to log anything in `UIGestureRecognizerStateEnded` condition? – Himanshu Joshi Mar 07 '14 at 10:58
  • yes i tried, its not calling even handlePanGesture: method – Konda Mar 07 '14 at 11:40
  • Can you please add the code for the gesture? – Himanshu Joshi Mar 07 '14 at 11:41
  • `- (void)handlePanGesture:(UIPanGestureRecognizer *)gestureRecognizer { switch (gestureRecognizer.state) { case UIGestureRecognizerStateBegan: case UIGestureRecognizerStateChanged: { //doing somthing here}} break; case UIGestureRecognizerStateEnded: { //calling method } default: { } break; } }` – Konda Mar 07 '14 at 11:45

1 Answers1

0

try this

    - (void)applicationWillResignActive:(UIApplication *)application {

        [self.window setUserInteractionEnabled:NO];

    }



    - (void)applicationDidBecomeActive:(UIApplication *)application {

        [self.window setUserInteractionEnabled:YES];
    }
  • touches are working fine. am able perform other actions in the view like button press. But that cell is still in the that place and not in the collectionview list – Konda Mar 07 '14 at 11:42
  • Even i reloaded the collectionview but that cell is at the same place and not added to the collectioview – Konda Mar 07 '14 at 11:50