ios - Get HTML body text only, no tags -


I have no knowledge of background or web development / designing and I currently work on an email client application on the iPhone I am using UIWebView for reading / writing e-mail.

I download emails as an object and let me bring topic, date, address and body from this object, but there is an HTML string with email body tag.

My Goal: to view the email body as a normal string without tag, such as the iPhone Mail app, or the Gmail app.

This is a good example:

GMAIL mymail

Thanks! Use UITextView with NSAttributedString Or label whatever you want

  NSString * oldHTMLstring = @ "& lt; b> testing . & Lt; Br> & lt; i & gt; HTML & lt; / i & gt ;, & lt; br & gt; & lt; u & gt; Body text. & Lt; / u & gt; "; NSAttributedString * newHTMLstring = [[NSAttributedString alloc] initWithData: [Old HTMLstring DataSetting Encoding: NSUTF8StringEncoding] Option: @ {NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: @ (NSUTF8StringEncoding)} documentRubute: zero error: zero]; [Set TextViewUnited Text: New HTMLstring]; // set credits [textView setText: [newHTMLstring string]]; // Set the normal text  

This will automatically convert the HTML to the appropriate text


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -