如何在UIWebView中使用自定义字体 [英] How to use a custom font inside a UIWebView

查看:75
本文介绍了如何在UIWebView中使用自定义字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用使用UIWebView加载xhtml文件的iPhone应用程序该html文件可能包含使用自定义字体的css文件,但由于该网络视图未在css文件中呈现该自定义字体,因此网络视图似乎不支持自定义字体.

I'm working on an iPhone application that use UIWebView which load xhtml files the html file could include css file that use custom fonts, but it's look like that the web view doesn't support custom fonts since it doesn't render the custom font in the css file

示例:xhtml文件:

example: xhtml file:

<head>   
    <link href="../Styles/p1.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <p class="line1">تجريب</p>
</body>
</html>

css文件:

@font-face {
font-family: "AHRAM";
font-style: normal;
font-weight: bold;
src:url("../Fonts/andlso.ttf");
} 

p.line1 {
font-family: "AHRAM";
}

有什么建议吗?提前thnx:)

any suggestion? thnx in advance :)

推荐答案

您是否正在将字体添加到info.plist(UIAppFonts键)中?

Are you adding the font to your info.plist (UIAppFonts key) ?

这是此过程的教程,其中显示了如何在UIWebView中使用字体.

Here's a tutorial for this process, which shows how to use the font in a UIWebView.

http://tetontech.wordpress.com/2010/09/03/using-custom-fonts-in-your-ios-application/

这篇关于如何在UIWebView中使用自定义字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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