主要思路是查找webView中的contentView,并从其中的interactions中找到对应的UIDragInteraction,然后删除掉即可;
如需删除drop等其它action,同理;
实例代码如下:
let scrollView = webView.scrollView
let contentView = scrollView.subviews.first(where: { $0.interactions.count > 1 })
guard let dragAction = (contentView?.interactions.compactMap {$0 as? UIDragInteraction}.first) else { return }
contentView?.removeInteraction(dragAction)
网友评论