如何使用UIWebView的HTML页面自定义字体? [英] how to use custom font in html pages for UIWebView?

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

问题描述

我有Futura.ttf字体文件。
我在UIWebView中显示了一个HTML页面,但是我的要求是我想在我的css文件中使用自定义字体。

I am having the "Futura.ttf" font file. I am displaying a HTML page in the UIWebView, but my requirement is that i want to use the custom font in my css file.

我可以在我的CSS文件中使用自定义字体的方式???

so is there any way that i can use the custom font in my css file ???

所有建议都欢迎。

感谢。

推荐答案

可以在iOS3.2及更高版本中将自定义字体加载到您的UIWebView中。将字体添加到您的包(请参阅这里),那么只需在您的UIWebView的样式表中引用字体,就像您使用其他任何字体一样:

It is possible to load custom fonts into your UIWebView in iOS3.2 and above. Add the font to your bundle (see here) then just reference the font in your UIWebView's stylesheet like you would any other font:

<style type='text/css'>font { font-family: DroidSerif; } </style>

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

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