I was wondering if it was possible to hide a particular word or expression from the text in a UITextView. If for example:
UITextView* txt = @"hello how are you"
Is there any way to hide the “you” so that it is not visible to the user (considering that the user can’t edit the txt, but is still part of the text, so that I can do txt.text to get the ehole string ?
As of iOS 6.0, UITextView can work with NSAttributedStrings (see the
attributedTextproperty) 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.