0

我想知道是否可以从 UITextView 的文本中隐藏特定的单词或表达式。例如:

UITextView* txt = @"hello how are you"

有什么办法可以隐藏“你”,使其对用户不可见(考虑到用户无法编辑txt,但仍然是文本的一部分,所以我可以做txt.text来获取ehole 字符串 ?

4

1 回答 1

1

As of iOS 6.0, UITextView can work with NSAttributedStrings (see the attributedText property) and using attributed strings, you can change the color to be clear (or hidden). It'll still be selectable, though, and may show up when highlighted.

And because of that last sentence, I'm not sure if this is what you want.

You may also find some helpful hints in this related question.

于 2013-02-07T21:46:39.707 回答