【问题标题】:WKWebView can not load the local HTML with the local frontWKWebView 无法用本地前端加载本地 HTML
【发布时间】:2017-06-07 09:16:37
【问题描述】:

当我改为使用 WKWebView 加载本地 HTML 时,出现了一些问题。由于自动缩放,我已将代码添加到 html 中。

<meta name="viewport" content="initial-scale=1.0" />

目前可以加载html,但是前面的类型不正确。显然,右边的(WKWebView)和左边的(UIWebView)是不一样的。我在项目中使用本地前台类型。

我想知道是否需要添加其他内容来加载具有正确前端类型的 html。请你帮助我好吗?提前致谢。

【问题讨论】:

    标签: html ios uiwebview


    【解决方案1】:

    场景:

    WkWebView 加载是通过字符串 html。 WkWebView 正在使用本地 .css。 字体是本地的,并添加到顶级项目中。 字体条目在 appName-info.plist 中的 key Fonts provided by application 下提供。

    解决方案:

    在顶层.css中添加字体如下

    @font-face
    {
        font-family: 'FontFamily';
        src: local('FontFamily'),url('FontFileName.otf') format('opentype');
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-03-22
      • 1970-01-01
      • 2018-12-26
      • 1970-01-01
      • 1970-01-01
      • 2017-05-24
      • 2022-11-17
      相关资源
      最近更新 更多