title: UICollectionView calling scrollViewDidScroll: when popped from the navigation stack
body: <p>I have a navigation controller, its root view controller is of type <code>CollectionViewControllerA</code>. Upon selecting an item, I have a fade out and expanding animation followed by a call to push a second view controller of type <code>CollectionVewControllerB</code> onto the stack:</p>
  
  <pre><code>CollectionViewControllerB *b = ... // construction of the view controller to be pushed
  [UIView animateWithDuration:.3
                   animations:^{
                       self.collectionView.transform = CGAffineTransformMakeScale(1.5, 1.5);
                       self.collectionView.alpha = 0;
                   }
                   completion:^(BOOL s){
                       [self.navigationController pushViewController:b animated:NO];
                   }];
  </code></pre>
  
  <p>I pop the view controller in a similar way</p>
  
  <pre><code>[UIView animateWithDuration:.3
                   animations:^{
                       self.collectionView.transform = CGAffineTransformMakeScale(.3, .3);
                       self.collectionView.alpha = 0;
                   }
                   completion:^(BOOL s){
                       [self.navigationController popViewControllerAnimated:NO];
                   }];
  </code></pre>
  
  <p>The problem here is that the app crashes when popping the view controller. Reason: </p>
  
  <pre><code>*** -[CollectionViewControllerB scrollViewDidScroll:]: message sent to deallocated instance
  </code></pre>
  
  <p>I understand that the problem is because the popped view controller is destroyed, but why does <code>scrollViewDidScroll:</code> get called in the first place? Nothing changes the <code>contentOffset</code> of the <code>collectionView</code> in code, and there is no user interaction either. Unless changing the <code>transform</code> property also triggers the method to get called?</p>
  
  <p><code>CollectionViewControllerB</code> implements <code>scrollViewDidScroll:</code> because I need to disable vertical scrolling.</p>
  
  <p>Meanwhile I have a very very messy hack to prevent the crash, that is before the animation, I add</p>
  
  <pre><code>self.collectionView.delegate = nil;
  </code></pre>
  
  <p>This stops the method from getting called. But there has to be a better way.</p>
  
  <p>Can anyone shed some light on why <code>scrollViewDidScroll:</code> is called and how it can be stopped?</p>