如何突出显示UITextView的文本的一部分? [英] How can I highlight a portion of the text of a UITextView?

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

问题描述

我想做的是,如果我的详细视图被调用,我只想突出显示UITextView元素的一部分文本.

What I would like to do is, if my detailed view gets called I would like to highlight just a part of the text of the UITextView element.

让我们说UITextView中的文本是:blatextbla.然后,我只想动态地突出显示textlate或用户想到的任何内容.

Let's say the text within the UITextView is: blatextbla. Then I would like to highlight dynamically only text or late or whatever comes to the user's mind.

我该怎么做?

推荐答案

您不能在UITextView中突出显示文本.

You can't highlight a text in a UITextView.

相反,您可以使用 NSAttributedString .

这篇关于如何突出显示UITextView的文本的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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