<tfoot id='eeuHq'></tfoot>

  • <legend id='eeuHq'><style id='eeuHq'><dir id='eeuHq'><q id='eeuHq'></q></dir></style></legend>

      1. <small id='eeuHq'></small><noframes id='eeuHq'>

          <bdo id='eeuHq'></bdo><ul id='eeuHq'></ul>
        <i id='eeuHq'><tr id='eeuHq'><dt id='eeuHq'><q id='eeuHq'><span id='eeuHq'><b id='eeuHq'><form id='eeuHq'><ins id='eeuHq'></ins><ul id='eeuHq'></ul><sub id='eeuHq'></sub></form><legend id='eeuHq'></legend><bdo id='eeuHq'><pre id='eeuHq'><center id='eeuHq'></center></pre></bdo></b><th id='eeuHq'></th></span></q></dt></tr></i><div id='eeuHq'><tfoot id='eeuHq'></tfoot><dl id='eeuHq'><fieldset id='eeuHq'></fieldset></dl></div>
      2. UIWebViews 的 iOS 自定义字体路径

        时间:2023-11-09
      3. <small id='igWSY'></small><noframes id='igWSY'>

            <bdo id='igWSY'></bdo><ul id='igWSY'></ul>
            <i id='igWSY'><tr id='igWSY'><dt id='igWSY'><q id='igWSY'><span id='igWSY'><b id='igWSY'><form id='igWSY'><ins id='igWSY'></ins><ul id='igWSY'></ul><sub id='igWSY'></sub></form><legend id='igWSY'></legend><bdo id='igWSY'><pre id='igWSY'><center id='igWSY'></center></pre></bdo></b><th id='igWSY'></th></span></q></dt></tr></i><div id='igWSY'><tfoot id='igWSY'></tfoot><dl id='igWSY'><fieldset id='igWSY'></fieldset></dl></div>

            • <legend id='igWSY'><style id='igWSY'><dir id='igWSY'><q id='igWSY'></q></dir></style></legend>
                <tbody id='igWSY'></tbody>

              <tfoot id='igWSY'></tfoot>

                  本文介绍了UIWebViews 的 iOS 自定义字体路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 UIWebView,我有一个自定义字体我想加载到一个可编辑的 html 文档中,我将通过 UIWebView 显示它.在我的 SupportingFiles(资源)文件夹中,我有Nosifer-Regular.ttf"...要在我的 HTML 中使用自定义字体,我需要字体拼贴的路径(URL)...我试过这样做,但它没有似乎不起作用...有什么想法吗?

                  I have a UIWebView and I have a custom font I want to load into an editable html document that I will be displaying through the UIWebView. In my SupportingFiles (resources) folder I have "Nosifer-Regular.ttf"... To use the custom font in my HTML I need the path (URL) to the font tile... I tried doing this, but it didn't seem to work... any ideas?

                  bundle = [NSBundle mainBundle];
                      pathFont = [bundle bundlePath];
                      fontURL = [NSBundle pathForResource:@"Nosifer-Regular" ofType:@"ttf" inDirectory:pathFont];
                      path_font = [fontURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
                      fileAppend = [[NSString alloc] initWithFormat:@"file://"];
                      path_font = [[NSString alloc] initWithFormat:@"%@%@", fileAppend, path_font];
                  

                  HTML (CSS):

                  The HTML (CSS):

                  @font-face {
                    font-family: 'Nosifer';
                    font-style: normal;
                    font-weight: 400;
                    src: local('Nosifer'), local('Nosifer-Regular'), url('%@') format('truetype');
                  }
                  

                  %@ 替换为path_font"(在上面的第一个代码块中定义)

                  Where %@ is replaced with "path_font" (defined above in the first code block)

                  推荐答案

                  首先,在你的info.plist中添加应用程序提供的字体"字段.它将是一个类似

                  First of all, add filed "Fonts provided by application" in your info.plist. It will be an array like

                  item0 myFont.otf
                  item1 anotherFont.ttf
                  

                  什么的.

                  在 HTML 中使用 font-face 添加字体.并将您的字体文件与 html 文件放在同一目录中.如果 HTML 是动态生成的并且没有从 bundle 中显示,那么你应该复制字体.

                  In HTML use font-face to add a font. And place your font files in the same directory with html file. If HTML is generated dynamically and not shown from bundle then you should copy font .

                  祝你好运.

                  这篇关于UIWebViews 的 iOS 自定义字体路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Google Play 错误:无法上传仅供测试的 APK 下一篇:WKWebView 在设备上显示空白,在模拟器上工作

                  相关文章

                    <small id='oOsKU'></small><noframes id='oOsKU'>

                    <i id='oOsKU'><tr id='oOsKU'><dt id='oOsKU'><q id='oOsKU'><span id='oOsKU'><b id='oOsKU'><form id='oOsKU'><ins id='oOsKU'></ins><ul id='oOsKU'></ul><sub id='oOsKU'></sub></form><legend id='oOsKU'></legend><bdo id='oOsKU'><pre id='oOsKU'><center id='oOsKU'></center></pre></bdo></b><th id='oOsKU'></th></span></q></dt></tr></i><div id='oOsKU'><tfoot id='oOsKU'></tfoot><dl id='oOsKU'><fieldset id='oOsKU'></fieldset></dl></div>
                    • <bdo id='oOsKU'></bdo><ul id='oOsKU'></ul>

                      <legend id='oOsKU'><style id='oOsKU'><dir id='oOsKU'><q id='oOsKU'></q></dir></style></legend>
                    1. <tfoot id='oOsKU'></tfoot>