Fix stretchy menu interaction not working on iPad
This commit is contained in:
parent
1e7e8b7f85
commit
168c5abbcf
|
@ -77,11 +77,14 @@ class ReadViewController: UIViewController {
|
||||||
if let content = itemContentHTML() {
|
if let content = itemContentHTML() {
|
||||||
webView.loadHTMLString(content, baseURL: item.url)
|
webView.loadHTMLString(content, baseURL: item.url)
|
||||||
}
|
}
|
||||||
|
webView.scrollView.alwaysBounceVertical = true
|
||||||
|
webView.scrollView.alwaysBounceHorizontal = false
|
||||||
view.addSubview(webView)
|
view.addSubview(webView)
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||||
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
// subtract 0.5, because otherwise, on ipad, the web view's scroll content view ends up being wider than the scroll view itself, causing the content to bounce horizontally
|
||||||
|
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -0.5),
|
||||||
webView.topAnchor.constraint(equalTo: view.topAnchor),
|
webView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||||
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||||
])
|
])
|
||||||
|
|
|
@ -56,7 +56,6 @@ class StretchyMenuInteraction: NSObject, UIInteraction {
|
||||||
panRecognizer.delegate = self
|
panRecognizer.delegate = self
|
||||||
panRecognizer.allowedScrollTypesMask = [.continuous]
|
panRecognizer.allowedScrollTypesMask = [.continuous]
|
||||||
view.addGestureRecognizer(panRecognizer)
|
view.addGestureRecognizer(panRecognizer)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var prevTranslation: CGFloat = 0
|
private var prevTranslation: CGFloat = 0
|
||||||
|
|
Loading…
Reference in New Issue