一个UIlabel中可以设置不同的字体吗? [英] Is it possible to set different font in One UIlabel?

查看:152
本文介绍了一个UIlabel中可以设置不同的字体吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个像这是一个好苹果的字符串。显示在我的UIlabel上。我想用不同的字体来设置good这个词。只要看起来像这是一个很好的苹果。

看看 NSAttributedString ...使用 OHAttributedLabel 绘制NSAttributedString,因为UILabel,UITextView不支持NSAttributedString ...


I have a string like "This is a good apple." to display on my UIlabel. I would like to set the word "good" with different font. Just look like "This is a good apple."

解决方案

Take a look at NSAttributedString... Use OHAttributedLabel draw NSAttributedString because UILabel,UITextView doesnot support NSAttributedString...

PS: if you plan to distribute an iOS6 or newer application, as UILabel now support NSAttributedString, you should use UILabel directly instead of OHAttributedLabel as it is now natively supported by the OS.

这篇关于一个UIlabel中可以设置不同的字体吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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