ios swift development


UIView -1.How to drag and drop a view


Hide/Show description

This video guides you how to make a drag and drop gesture(UIPanGestureRecognizer, UILongPressGestureRecognizer). After dragging, the view will be located in the new position. There are some steps: 1. Create a basic Xcode project with a UIView named dragAndDropView. 2. Add layout constraints to layout dragAndDropView as: width = height = 100px, align top and align left to View = 2px 3. Create a UILongPressGestureRecognizer to dragAndDropView, minimumPressDuration = 0. 4. when user drags and drops the dragAndDropView, change the dragAndDropView's frame to new coordinator. SUBSCRIBE TO CHANNEL: https://www.youtube.com/c/NguyenDucHoang Twitter: https://twitter.com/NguyenD97601913 Facebook: https://www.facebook.com/nguyen.duc.hoang.bk