有一半 UILabel 文本加粗,另一半没有? [英] Have half a UILabel text bold and half not?

查看:45
本文介绍了有一半 UILabel 文本加粗,另一半没有?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的 UILabeltext 的一半为粗体,另一半为非粗体.我该怎么做?

I want half of my UILabel's text to be bold and half to not be bold. How can I do this?

推荐答案

NSAttributedString 允许在字符串中指定格式,但遗憾的是,UIKit 还没有对此做任何事情.但是,有一些开源实现可以这样做.查看 OHAttributedLabel.

NSAttributedString allows for specification of formatting within a string, but sadly, UIKit does not yet do anything with this. However, there are a few open-source implementations that do. Check out OHAttributedLabel.

这篇关于有一半 UILabel 文本加粗,另一半没有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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