浏览UIWebView中的文件夹

问题描述 投票:0回答:1

我的问题如下。我对在UIWebView中加载资源的路径感到有点困惑。我想让我的链接活跃起来。目前,WebView没有获取其他文件夹中的资源(.css,.html),而它们之间的链接是正确的。你知道怎么解决这个问题吗?我现在正在这样做

NSString* path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]; NSString* htmlString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; [WebView loadHTMLString:htmlString baseURL:[NSURL fileURLWithPath:path]];

谢谢你读我!

iphone path uiwebview hyperlink nsurl
1个回答
1
投票

你可以尝试这样,它可能是有用的:

[webview loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"webPage" ofType:@"html"]]]];
© www.soinside.com 2019 - 2024. All rights reserved.