开发者

Browsing through folders in a UIWebView

开发者 https://www.devze.com 2023-01-31 17:49 出处:网络
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

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 t开发者_如何学Pythonhis ? 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 !


Can you try like this, it may be useful:

[webview loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"webPage" ofType:@"html"]]]];
0

精彩评论

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

关注公众号