Ryan
Ryan

Reputation: 4884

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?

Upvotes: 2

Views: 379

Answers (2)

matt
matt

Reputation: 535306

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.

Upvotes: 5

Craig Siemens
Craig Siemens

Reputation: 13276

Not sure what that gesture recognizer is for, it could possibly be related to the new gesture for dragging the scroll indicator but that's just a guess.

One thing you could try to get your working is to set yourself as the delete of your gesture then implement the following delegate method to always return true.

gestureRecognizer(_:shouldRecognizeSimultaneouslyWith:)

Upvotes: 3

Related Questions