Fix stretchy menu interaction not working on iPad
This commit is contained in:
parent
1e7e8b7f85
commit
8db60a313e
|
@ -61,7 +61,8 @@ class ReadViewController: UIViewController {
|
|||
navigationItem.largeTitleDisplayMode = .never
|
||||
|
||||
view.backgroundColor = .appBackground
|
||||
view.addInteraction(StretchyMenuInteraction(delegate: self))
|
||||
let menuInteraction = StretchyMenuInteraction(delegate: self)
|
||||
view.addInteraction(menuInteraction)
|
||||
|
||||
webView = WKWebView()
|
||||
webView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
@ -77,6 +78,8 @@ class ReadViewController: UIViewController {
|
|||
if let content = itemContentHTML() {
|
||||
webView.loadHTMLString(content, baseURL: item.url)
|
||||
}
|
||||
webView.scrollView.alwaysBounceHorizontal = false
|
||||
webView.scrollView.panGestureRecognizer.require(toFail: menuInteraction.panRecognizer!)
|
||||
view.addSubview(webView)
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
|
|
|
@ -23,6 +23,7 @@ class StretchyMenuInteraction: NSObject, UIInteraction {
|
|||
weak var delegate: StretchyMenuInteractionDelegate?
|
||||
|
||||
private(set) weak var view: UIView? = nil
|
||||
private(set) var panRecognizer: UIPanGestureRecognizer?
|
||||
|
||||
private let menuHintView = MenuHintView()
|
||||
fileprivate let feedbackGenerator = UIImpactFeedbackGenerator(style: .medium)
|
||||
|
@ -56,7 +57,7 @@ class StretchyMenuInteraction: NSObject, UIInteraction {
|
|||
panRecognizer.delegate = self
|
||||
panRecognizer.allowedScrollTypesMask = [.continuous]
|
||||
view.addGestureRecognizer(panRecognizer)
|
||||
|
||||
self.panRecognizer = panRecognizer
|
||||
}
|
||||
|
||||
private var prevTranslation: CGFloat = 0
|
||||
|
|
Loading…
Reference in New Issue