浏览 UIWebView 中的文件夹
我的问题如下。我对 UIWebView 中加载的资源路径有点困惑。我想让我的链接处于活动状态。目前,WebView 无法获取其他文件夹中的资源(.css、.html),而它们之间的链接是正确的。你知道如何解决这个问题吗? 我目前正在这样做
NSString* path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]; NSString* htmlString = [NSString stringWithContentsOfFile:路径编码:NSUTF8StringEncoding 错误:nil]; [WebView loadHTMLString:htmlString baseURL:[NSURL fileURLWithPath:path]];
感谢您阅读我的内容!
My question is the following. I'm a bit confused about the path of resources to be loaded in a UIWebView. I'ld like to make my links active. For the moment the WebView isn't getting resources (.css, .html) that are in other folders while the link between them is correct. Do you know how to fix this ?
I'm currently doing like this
NSString* path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
NSString* htmlString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
[WebView loadHTMLString:htmlString baseURL:[NSURL fileURLWithPath:path]];
Thanks for reading me !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以尝试这样,它可能有用:
Can you try like this, it may be useful: