如何在 WKWebView 中设置默认缩放 [英] How do I set a default zoom in a WKWebView

查看:59
本文介绍了如何在 WKWebView 中设置默认缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 WKWebView 设置来显示 CSV 文件的内容.它工作正常,但内容被缩小了很多,需要用户放大.

I have a WKWebView setup to display contents of a CSV file. It works fine but the content is zoomed out a lot requiring the user to zoom in.

有没有办法在 WKWebView 中设置默认缩放?这样当它显示时,内容已经放大了 x 量?

Is there a way to set a default zoom in a WKWebView? So that when its displayed, the content is already zoomed in an x amount?

我已经尝试在 webview 的滚动视图上设置 minimumZoomScale 但它似乎没有做任何事情.

I already tried setting a minimumZoomScale on the webview's scrollview but it doesn't seem to do anything.

推荐答案

您是否将 zoomScale 设置为您的 scrollView?webView.scrollView.zoomScale = '你的默认'

Did you set the zoomScale to your scrollView then? webView.scrollView.zoomScale = 'your default'

如果你只设置minimumZoomScale,它不会工作.

It won't work if you only set the minimumZoomScale.

这篇关于如何在 WKWebView 中设置默认缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆