Based on the comments, you are trying to use NSAttributedString . NSAttributedString and UITextView are only for handling documented attributes. You can first save the user attributes in a string, but as soon as the text view starts processing the sent text, and you ask for the text view for the last attribute of the text, the text view will get rid of any user attributes for a long time.
A better solution would be to create a class extending the UITextView. Your subclass should add a property that can contain any custom attributes. Or maybe your custom class will override the attributedText and setAttributedText: methods. They will take care of saving and restoring any custom attributes found in the attribute string.
Note. this answer applies to iOS 6 and earlier . For iOS 7 see @julien_c answer below.
source share