Q: View Jumps back to original position after click onto another view I am dragging and dropping using UIviews in storyboard, but everytime I drag the view and then click another view, the view jumps back to its original position.I am trying to make the view stay where the user dropped it. Thank you! 
 My code below in swift.
@IBOutlet weak var brokeView: UIView!
//
 let brokeRec = UIPanGestureRecognizer()
        brokeRec.addTarget(self, action: #selector(PhotoWidget.draggedView(_:)))
        brokeView.addGestureRecognizer(brokeRec)
        brokeView.userInteractionEnabled = true
//
 func draggedView(sender:UIPanGestureRecognizer){
        self.view.bringSubviewToFront(sender.view!)
        let translation = sender.translationInView(self.view)
        sender.view!.center = CGPointMake(sender.view!.center.x + translation.x, sender.view!.center.y + translation.y)
        sender.setTranslation(CGPointZero, inView: self.view)
    }


A: If you are using AutoLayout, you have to reset the constraints to the dropped position.
