title: Gracefully cancel UIScrollView touch (with animation)
body: <p>There are myriad answers on cancelling a <code>UIScrollView</code>'s touches (<a href="https://stackoverflow.com/questions/18497192/cancel-current-uiscrollview-touch">example SO question</a>). However, the generally accepted answer (see prior example) is to do this by directly cancelling the scrollView's gesture recogniser, as below:</p>
  
  <pre><code>// Reset a scrollView's current 'touch' 
  scrollView.panGestureRecognizer.enabled = false
  scrollView.panGestureRecognizer.enabled = true
  </code></pre>
  
  <p>The issue I'm currently having with this <em>solution</em> is that it cancels the ability for the scrollView to animate smoothly, and results in jumpy behaviour once you try to manipulate/animate the scrollView's <code>contentOffset</code> property.</p>
  
  <p>In short, what I am trying to do is: once a <strong>paged scrollView</strong> reaches a certain content offset above its current page, cancel the current touch on the scrollView, animate back to the current page, and only then allow touches once more. You can liken this to having a scrollView containing a deck of cards that are only able to be scrolled through in one direction — if you attempt to go back (up) a card in the scrollView, you are stopped at a certain offset and the scrollView force-animates back down to the card you were on. </p>
  
  <p><em>[Note — I understand there are other, more efficient ways to do this with gesture recognisers and custom views, but my need for a scrollView is more nuanced]</em></p>
  
  <p>My code below (via my scrollView's delegate), cancels the current touch, but does not allow animation to happen. It simply 'snaps' back to place. Interestingly, without the pan gesture reset, the animation does happen — but of course since the pan gesture has not been reset the touch is allowed to continue dragging (even with <code>userInteractionEnabled</code> set to false).</p>
  
  <pre><code> // Delegate methods
   func scrollViewDidScroll(scrollView: UIScrollView) {
  
       if (scrollView.contentOffset.y &lt;= (scrollView.frame.height PAGE_NUMBER - OFFSET_MARKER) { 
           // Where PAGE_NUMBER is the current page, and OFFSET_MARKER is the amount of pixels to trigger at, i.e. 80px
  
           // Temporarily stop further user interaction
           scrollView.userInteractionEnabled = false
  
           // Reset the pan gesture recogniser -- THIS CAUSES 'SKIPPING' OF ANIMATION
           scrollView.panGestureRecognizer.enabled = false
           scrollView.panGestureRecognizer.enabled = true
  
           // I have tried both 'animated: true / false'
           UIView.animateWithDuration(0.4, animations: {
               scrollView.setContentOffset(CGPointMake(0, self.frame.height), animated: true)
               }, completion: { (complete) in
                   if complete{
                       // Re-enable user interaction (more touches)
                       scrollView.userInteractionEnabled = true
                   }
           })    
       }
  }
  </code></pre>
  
  <p>Any thoughts? Hopefully I'm missing something...</p>