2014-07-16 3 views
-3

Je souhaite charger le fichier html que j'ai enregistré dans Core Data. il obtient quelque chose comme ça dans le NSString:Comment charger FilePath dans UIWebbview dans iOS?

fichier

: ///Users/rajeevrajani/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/1339BAA2-127D-4C0C-8C35-5ADA33C46A70/DemoApp. app/0Dosing.html

Je veux charger ceci dans UIWebview. Comment faire cela?

+3

Veuillez faire quelques recherches avant de poster une question. –

Répondre

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 
+0

Merci Alex. – Sonu

0

recherche avant de poster une question.

NSString *htmlFile = //ur file path put here... 
    NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil]; 
    [webView loadHTMLString:htmlString baseURL:nil]; 

Ceci peut vous être utile Merci.

Questions connexes