From d1f1ca22b61cf6c95f93843f6f62728d9e7a4a7a Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 5 Feb 2020 13:46:59 -0800 Subject: [PATCH] Add a hack to prevent horizontal scrolling on iPad. Issue #1714 --- iOS/Article/WebViewController.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index 886f752e4..ea7fd4a50 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -418,7 +418,12 @@ private extension WebViewController { self.view.topAnchor.constraint(equalTo: webView.topAnchor), self.view.bottomAnchor.constraint(equalTo: webView.bottomAnchor) ]) - + + // UISplitViewController reports the wrong size to WKWebView which can cause horizontal + // rubberbanding on the iPad. This interferes with our UIPageViewController preventing + // us from easily swiping between WKWebViews. This hack fixes that. + webView.scrollView.contentInset = UIEdgeInsets(top: 0, left: -1, bottom: 0, right: 0) + self.view.setNeedsLayout() self.view.layoutIfNeeded()