我想加载我在Core Data中保存的html文件。 它在NSString中得到类似的东西:
文件:///Users/rajeevrajani/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/1339BAA2-127D-4C0C-8C35-5ADA33C46A70/DemoApp.app/0Dosing.html
我想将其加载到UIWebview中。 怎么做?
答案 0 :(得分:0)
NSString *htmlFile = //ur file path put here...
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:htmlString baseURL:nil];
它可能对你有所帮助。
答案 1 :(得分:0)
NSString *urlString = @"//filepath.html"; // get your file path here
NSURL *webPageURL = [NSURL URLWithString: urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:webPageURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:0];
[_webView loadRequest:request]; // _webView is the UIWebView Outlet