我正在使用 WKWebView,我尝试显示的页面在水平方向上非常大,并且 WKWebView 试图将所有内容都放入 View 中,但它看起来确实缩小了。有没有办法让WKWebView可滚动而不缩小?它可以垂直滚动,但不能水平滚动。
//Create a new Web View
webView = WKWebView()
//Assign the Web View Delegate to self
webView.navigationDelegate = self
//Define and populate the URL for the Web View
let url = URL (string: "http://www.example.com");
//Load the URL into the Web View
webView.load(URLRequest(url: url!))
//Assign the Web View as the View
view = webView
这是结果
有什么办法可以解决这个问题吗?
最佳答案
我通过将以下内容添加到 HTML 中解决了这个问题:
<meta name="viewport" content="initial-scale=1.0" />
关于ios - WKWebView 可水平滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53522563/