Search code examples
iosswiftuilongpressgesturerecogni

Adding UILongPressGesture to UITableView in iOS13


I've been using UILongPressGesture with UITableView for over a year, but I found that this doesn't work in iOS13.

In iOS13, Apple added this gesture to UIScrollView and I'm not sure it is safe to replace it to my own.

<UIScrollViewKnobLongPressGestureRecognizer: 0x7f938c051c00; state = Possible; target= <(action=_handleKnobLongPressGesture:, target= 0x7f938991b000>)>>

Anyone knows about this issue? or knows what _handleKnobLongPressGesture action for?


Solution

  • You didn't show your code or explain what your long press gesture recognizer is for, but your code was probably always wrong. In iOS 13, there are at least two long press gesture recognizers ahead of you:

    • Long press to summon a UIMenu

    • Long press to begin a drag (drag and drop)

    It seems improbably that you could add a long press gesture recognizer and manage to negotiate the demands of the runtime's own expectations about what a long press should mean. You're probably better off modifying your gesture to eliminate all possibility of conflict.