2012-12-23 86 views
0

我構建簡單的應用程序。我創建了UITableView和DetailViewController。我在標題中創建了UITableView加載本地HTML

DetailViewController int *webNumber and UIWebView *webName 

DetailViewController.m 

switch (webNumber) 
{ 
    case 0: 
} 

如何加載本地HTML?

(我寫的從我的iPhone對不起碼這個話題)

回答

0

我會嘗試這樣的事:

NSString *path = [[NSBundle mainBundle] pathForResource:@"my-local-html-file" ofType:@"html" inDirectory:nil]; 
NSString *html = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; 
[webName loadHTMLString:html baseURL:[[NSBundle mainBundle] resourceURL]]; 

more info about loadHTMLString:baseURL in Apple Docs

0

只需使用

[self.webName loadHTMLString:yourHTMLString baseURL:nil]; 

地方HTML。如果要加載URL,請更改baseURL: