You would like to attach a long gesture recognizer when printing to the general list of both collections. The drag and drop operation starts with a long press, and the entire transaction is processed inside this recognizer. Since the pan gesture is used to scroll through the collection, you will encounter problems when trying to use the pan recognizer.
The key point is the gesture recognizer that must be attached by the COMMON superview, and all points and rectangles are converted to the supervisor's coordinate system.
This is not an exact code (it moves from CV to another view), but the process will be similar (NOTE: I tried to highlight some code that is not related to your application, so I could ruin something in this process - but concept is preserved):
- (void) processLongPress:(UILongPressGestureRecognizer *)sender { if (sender.state == UIGestureRecognizerStateChanged) { if (!dragView) return; CGPoint location = [sender locationInView:self.view]; CGPoint translation; translation.x = location.x - dragViewStartLocation.x; translation.y = location.y - dragViewStartLocation.y; CGAffineTransform theTransform = dragView.transform; theTransform.tx = translation.x; theTransform.ty = translation.y; dragView.transform = theTransform; [self.view bringSubviewToFront:dragView]; return; } if (sender.state == UIGestureRecognizerStateBegan) {
RegularExpression
source share