Yiming Tang
Yiming Tang

Reputation: 557

How to display email body on iOS

I'm developing an email app on iOS. I want to create a view that can display email. My problem is that an email body may be plain text or HTML(sometimes with CSS), so I can't find a proper UI component for such content. I tried UIWebView, but when the content is plain text, the line breaks are ignored!

How about convert the plain text to HTML? Or just use UITextView to display content which is plain text? So, do you have any suggestions?

Update:

To addition, many HTML contents contain images most of which are just urls. If I use a text based view how can I display the images? Is there any library support such features?

Upvotes: 0

Views: 457

Answers (2)

Paresh Navadiya
Paresh Navadiya

Reputation: 38249

Use third party textView - A rich text view for iOS with basic HTML rendering. follow bctextview link.

Upvotes: 1

Asciiom
Asciiom

Reputation: 9975

You should use UIWebView and convert the linebreaks to br tags, like this:

HtmlText = [dataString stringByReplacingOccurrencesOfString:@"\n" withString:@"<br/>"];  

Upvotes: 1

Related Questions