如何在iPhone上显示NSAttributedString? [英] How do I display a NSAttributedString on an iPhone?

查看:156
本文介绍了如何在iPhone上显示NSAttributedString?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信我理解如何设置NSAttributedString值,但实际上你是如何在界面中显示它们的?



示例:UILabel,UITextView等



具体说明将不胜感激/




  • 谢谢!


解决方案


在iOS 6及更高版本中,您可以使用属性字符串来显示格式化的
文本视图,文本字段和一些其他控件中的文本。 AppKit
和UIKit都定义了基本属性字符串
接口的扩展,允许您在当前的
图形上下文中绘制它们的内容。


NSAttributedString参考


I believe I understand how to set NSAttributedString values but how on earth do you actually display them in the interface?

examples: UILabel, UITextView, etc.

Specific instructions would be greatly appreciated/

  • Thanks!

解决方案

In iOS 6 and later you can use attributed strings to display formatted text in text views, text fields, and some other controls. Both AppKit and UIKit also define extensions to the basic attributed string interface that allows you to draw their contents in the current graphic context.

NSAttributedString Reference

这篇关于如何在iPhone上显示NSAttributedString?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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