简体   繁体   English

在UIWebView中显示文档目录中的HTML页面

[英]Display HTML Pages from Documents Directory in UIWebView

I am unzipping an EPUB file and storing it in the Documents directory within a folder. 我要解压缩EPUB文件并将其存储在文件夹内的Documents目录中。

Now I would like display all the HTML pages in a UIWebView and display all the HTML page names in a tableView. 现在,我想在UIWebView中显示所有HTML页面,并在tableView中显示所有HTML页面名称。

For example, if i have Introduction_1.html then I would like to display "Introduction_1" in the tableview and so on. 例如,如果我有Introduction_1.html那么我想在表格视图中显示“ Introduction_1”,依此类推。

Thanks in Advance 提前致谢

Here the documentDirectory stands for the path of document directory. 这里documentDirectory代表文档目录的路径。 If your files are situated at place other than document directory , obviously you may place the path there. 如果您的文件位于文档目录之外的其他位置,则显然可以将路径放在此处。

  NSArray *dirContents = [[NSFileManager defaultManager] directoryContentsAtPath:documentDirectory];
    NSString *strFinalPath = [dirContents stringByAppendingPathComponent:@"OEBPS"];
    for (NSString *tString in strFinalPath) 
    {
        if ([tString hasSuffix:@".html"])
        {    
            NSLog(@"File name -> %@",tString);    
        }
    }

Hope ,it was helpful. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM