简体   繁体   English

在iOS13中将UILongPressGesture添加到UITableView

[英]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. 我已经将UILongPressGestureUITableView使用了一年多,但是我发现这在iOS13中不起作用。

In iOS13, Apple added this gesture to UIScrollView and I'm not sure it is safe to replace it to my own. 在iOS13中,Apple将此手势添加到了UIScrollView ,但我不确定将其替换为我自己的手势是安全的。

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

Anyone knows about this issue? 有人知道这个问题吗? or knows what _handleKnobLongPressGesture action for? 或知道_handleKnobLongPressGesture作用是什么?

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: 在iOS 13中,您前面至少有两个长按手势识别器:

  • Long press to summon a UIMenu 长按以调用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. 最好修改手势以消除所有冲突可能性。

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 . 您可以尝试做的一件事是将自己设置为手势删除,然后实现以下委托方法以始终返回true

gestureRecognizer(_:shouldRecognizeSimultaneouslyWith:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM