iOS解决方案,用于在UIWebView中显示NSString中包含的HTML

ghi*_*boz 1 objective-c

是否可以显示当前的HTML我NSStringUIWebView

我的解决方案是将html写入文件,然后像这样解析它:

[WebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO]]];
Run Code Online (Sandbox Code Playgroud)

但是,我更喜欢更优雅的解决方案.

勿绮语*_*勿绮语 9

使用UIWebView loadHTMLString方法.