开发者

Can you add an html file in the xcode groups folder and open it in a UIWebView?

开发者 https://www.devze.com 2023-04-12 14:46 出处:网络
I want to load an html file on a web view without having to upload it to the web. I have the file in my group开发者_高级运维s folder in xcode. Can i open this in a webview?Just get the path to your re

I want to load an html file on a web view without having to upload it to the web. I have the file in my group开发者_高级运维s folder in xcode. Can i open this in a webview?


Just get the path to your resource, and tell your webview to load it. This should be similar to what you'd need.

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

Where the webView is an IBOutlet to your UIWebView

0

精彩评论

暂无评论...
验证码 换一张
取 消