ghiboz
ghiboz

Reputation: 7993

iOS Solutions to display HTML contained in an NSString in a UIWebView

Is it possible to display an html present in my NSString into a UIWebView?

My solution is to write the html into a file and afterwards, parse it like this:

[WebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO]]];

However, I would prefer a more elegant solution.

Upvotes: 1

Views: 1133

Answers (1)

勿绮语
勿绮语

Reputation: 9320

Use UIWebView loadHTMLString method.

Upvotes: 9

Related Questions