@@ -100,6 +100,9 @@ - (void)setupCollectionView {
100100 action: @selector (handlePanGesture: )];
101101 _panGestureRecognizer.delegate = self;
102102 [self .collectionView addGestureRecognizer: _panGestureRecognizer];
103+
104+ // Useful in multiple scenarios: one common scenario being when the Notification Center drawer is pulled down
105+ [[NSNotificationCenter defaultCenter ] addObserver: self selector: @selector (handleApplicationWillResignActive: ) name: UIApplicationWillResignActiveNotification object: nil ];
103106}
104107
105108- (id )init {
@@ -324,6 +327,7 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer
324327
325328 [self invalidateLayout ];
326329 } break ;
330+ case UIGestureRecognizerStateCancelled:
327331 case UIGestureRecognizerStateEnded: {
328332 NSIndexPath *currentIndexPath = self.selectedItemIndexPath ;
329333
@@ -402,6 +406,7 @@ - (void)handlePanGesture:(UIPanGestureRecognizer *)gestureRecognizer {
402406 } break ;
403407 }
404408 } break ;
409+ case UIGestureRecognizerStateCancelled:
405410 case UIGestureRecognizerStateEnded: {
406411 [self invalidatesScrollTimer ];
407412 } break ;
@@ -478,6 +483,13 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
478483 }
479484}
480485
486+ #pragma mark - Notifications
487+
488+ - (void )handleApplicationWillResignActive : (NSNotification *)notification {
489+ self.panGestureRecognizer .enabled = NO ;
490+ self.panGestureRecognizer .enabled = YES ;
491+ }
492+
481493#pragma mark - Depreciated methods
482494
483495#pragma mark Starting from 0.1.0
0 commit comments