简体   繁体   English

Font Awesome图标无法在Phonegap iOS应用程序中呈现

[英]Font Awesome icons not rendering in Phonegap iOS application

Rather then render the icons I am getting small squares: 而不是渲染图标我得到小方块:

屏幕截图2014-07-31 at 8 26 32 pm

It works perfectly fine within the browser, but when I viewed my app in iOS Simulator or Mobile Safari, the squares were there. 它在浏览器中运行得非常好,但是当我在iOS模拟器或移动Safari中查看我的应用程序时,正方形就在那里。

Thanks so much for your help! 非常感谢你的帮助!

i had the same issue. 我遇到过同样的问题。 I put the "font-awesome.min.css" file directly in my cordova ios xcode and than i called it in the "index.html" file, with: 我将“font-awesome.min.css”文件直接放在我的cordova ios xcode中,而不是在“index.html”文件中调用它,其中:

<link rel="stylesheet" href="css/font-awesome.min.css">

after that i try to use the font awesome spinner instead the default jQuery Modile preloader, with this code even in "index.html" before jQuery Mobile call: 之后我尝试使用字体awesome spinner而不是默认的jQuery Modile预加载器,在jQuery Mobile调用之前甚至在“index.html”中使用此代码:

<script>
        $(document).bind( 'mobileinit', function(){
                         $.mobile.loader.prototype.options.text = "loading";
                         $.mobile.loader.prototype.options.textVisible = true;
                         $.mobile.loader.prototype.options.theme = "p";
                         $.mobile.loader.prototype.options.textonly = false;
                         $.mobile.loader.prototype.options.html = "<span class='ui-bar ui-overlay-c ui-corner-all'><i class='fa fa-spinner fa-spin fa-5x' style='color:#000;'></i></span>";
                         });
</script>

The result is the same a rotate square, Where i'm wrong? 结果是一个旋转的方块,我哪里错了?

First, install Font Awesome: 首先,安装Font Awesome:

Download the latest Font Awesome version Double-click fontawesome-webfont.ttf and install it on your laptop/desktop (optional) Copy fontawesome.css to www/css Remove the references to font files in fontawesome.css, ie remove @font-face declaration Then in Xcode: 下载最新的Font Awesome版本双击fontawesome-webfont.ttf并将其安装在您的笔记本电脑/台式机上(可选)将fontawesome.css复制到www / css删除fontawesome.css中对字体文件的引用,即删除@ font-face声明然后在Xcode中:

Copy fontawesome-webfont.ttf into “Your Project/Resources/fonts/fontawesome-webfont.ttf” Add Font Awesome to the .plist file by selecting the “Info” tab Add a new property named “Fonts provided by application” and set the value to “fontawesome-webfont.ttf” Clean and build your project. 将fontawesome-webfont.ttf复制到“Your Project / Resources / fonts / fontawesome-webfont.ttf”中,通过选择“Info”选项卡,将Font Awesome添加到.plist文件中添加名为“由应用程序提供的字体”的新属性并设置价值“fontawesome-webfont.ttf”清理并构建您的项目。 Font Awesome is now ready to be used. Font Awesome现在可以使用了。

Phonegap example: class="fa fa-cog" Phonegap示例:class =“fa fa-cog”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM