0

我的问题如下。我对要在 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]];

谢谢你读我!

4

1 回答 1

1

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

[webview loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"webPage" ofType:@"html"]]]];
于 2010-12-18T06:03:59.373 回答