Split sensory sequence between multiple instances of UIGestureRecognizer

I am developing an iPhone / iPad application that supports dragging and dropping items between tabular views. Since all tables do not fit on the screen, I wrote a custom UIScrollViewone that exposes them horizontally and supports swapping.

While I got the main drag and drop together, there are a few remaining issues that I cannot overcome.

  • After the user has selected the item to drag and drop, he cannot scroll UIScrollViewto find the destination UITableView.

  • Sometimes the user wants to drag an item within the same table view. But as soon as the drag started, the table view no longer recognizes the scroll gesture.

I tried various options, including implementation, UIGestureRecognizerDelegateand allowing multiple gesture recognizers to recognize gestures at the same time.

The problem, as I see it, stems from this description from the event handling guide: “iOS recognizes one or more fingers by touching the screen as part of a multitouch sequence. This sequence starts when the first finger touches the screen and ends when the last finger rises from the screen. "

UIGestureRecognizerinstances always match the entire sequence. In my case, I want to divide one sequence down into discrete gestures - some touches recognize the drag and drop of an element, while different strokes in the same sequence should be recognized as scroll or scroll gestures. In fact, I want my gesture recognizers to recognize at the same time, but only different strokes. When a person recognizes a touch as part of a gesture, that touch should be ignored by others.

I have not found a way to solve all these problems consistently using the UIGestureRecognizerdefault subclasses , and now I'm going to write my own custom mut-recognizer gesture-recognizer.

I would rather not do this - is there a better way to achieve the same result?

+3

Source: https://habr.com/ru/post/1769892/


All Articles