             if let dv = draggingView {
                 dv.center = gesture.locationInView(view)
             }
-        case UIGestureRecognizerState.Ended:
+        case UIGestureRecognizerState.Ended, UIGestureRecognizerState.Cancelled:
             if let dv = draggingView {
                 UIView.animateWithDuration(0.2, animations: { () -> Void in
                     dv.transform = CGAffineTransformIdentity

            myCollectionView.addGestureRecognizer(tapRecognizer)
            
            let longPressRecognizer = UILongPressGestureRecognizer(target: self, action: "handleLongPress:")
            myCollectionView.addGestureRecognizer(longPressRecognizer)
        }
        


import UIKit

class ViewController: UICollectionViewController, UIGestureRecognizerDelegate {

    var items: [AnyObject] = [];
    var folderDataSource = FolderDataSource()
