0

I want to load the following html string in Uitableview cell.How to load it ?

<p>\r\n\t  Whether you are viewing a premium-quality 2D picture or seeing incredible 3D depth, images are breathtakingly real in Samsung Full HD. Combine with a 3D TV and 3D active shutter glasses to view the latest Hollywood 3D titles or amplify your viewing experience by upconverting 2D content to immersive 3D.\r\n</p>
Madhumitha
  • 3,794
  • 8
  • 30
  • 45

2 Answers2

1

you can use NSAttributed String for load in UILabel or use UItextView to load HTML String for e.g

let htmlString: String = "<p>\r\n\t  Whether you are viewing a premium-quality 2D picture or seeing incredible 3D depth, images are breathtakingly real in Samsung Full HD. Combine with a 3D TV and 3D active shutter glasses to view the latest Hollywood 3D titles or amplify your viewing experience by upconverting 2D content to immersive 3D.\r\n</p>"

let  attrStr: NSAttributedString = try! NSAttributedString(data: htmlString.dataUsingEncoding(NSUnicodeStringEncoding), options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], documentAttributes: nil)


yourlabel.attributedText = attrStr

for additional help see this

else if you need third party lib use RTLabel it will load the all type of string in label

Community
  • 1
  • 1
Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
-1

Then you have to take web view in your table view cell because without webview how you can load the html string. According to my knowledge it is not possible to load html query except UIWebView.

So, you can take UIWebView in tableview's cell and can load html to that webview in cellforrowatindexpath method.

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75