【发布时间】:2012-02-01 07:44:18
【问题描述】:
我正在解压缩 EPUB 文件并将其存储在文件夹内的 Documents 目录中。
现在我想在 UIWebView 中显示所有 HTML 页面,并在 tableView 中显示所有 HTML 页面名称。
例如,如果我有Introduction_1.html,那么我想在表格视图中显示“Introduction_1”等等。
提前致谢
【问题讨论】:
我正在解压缩 EPUB 文件并将其存储在文件夹内的 Documents 目录中。
现在我想在 UIWebView 中显示所有 HTML 页面,并在 tableView 中显示所有 HTML 页面名称。
例如,如果我有Introduction_1.html,那么我想在表格视图中显示“Introduction_1”等等。
提前致谢
【问题讨论】:
这里的documentDirectory 代表文档目录的路径。如果您的文件位于文档目录以外的位置,显然您可以将路径放在那里。
NSArray *dirContents = [[NSFileManager defaultManager] directoryContentsAtPath:documentDirectory];
NSString *strFinalPath = [dirContents stringByAppendingPathComponent:@"OEBPS"];
for (NSString *tString in strFinalPath)
{
if ([tString hasSuffix:@".html"])
{
NSLog(@"File name -> %@",tString);
}
}
希望对您有所帮助。
【讨论】: