Underlined text in iPhone TextView

I have the following text in an RTF file ..

"The possibility of an attack on an Indian station, a nuclear power plant, forced local government officials to plan assessment routes, build shelters and offer citizens potassium tablets so that there would be less casualties in the event of a leak."

In this text, “plan assessment routes, build shelters, and offer citizens potassium pills so that they are” is an underlined text. When I copy this text to sqlite database and show it on Simulator using TextView, I do not get UnderLine ... How to get it on iPhone ..? From which Format (word, pdf ..) of the documents I want to copy to get the exact text ...

+3
source share
2 answers

UITextView does not support text attributes. You can use UIWebview with some html to do this (easy way) or write your own text field using Coretext and NSAttributedString. This site has pretty detailed information about what follows: http://www.raywenderlich.com/4147/how-to-create-a-simple-magazine-app-with-core-text

0
source

TextView does not support underline text because it has one font behavior and does not support multiFont and text attributes. You can use the webview inside the text view for the RTF file. Try this link, it has a lot of HTMl, which is easy to understand. http://kiefermat.com/2011/09/30/using-uiwebview-for-displaying-rich-text/

0
source

All Articles