UITableView
ドキュメントディレクトリの内容を一覧表示するがあります。その中にいくつかのzipファイルがあります。内のファイルをタッチするUITableView
と、対応するzipファイルが解凍され、一時ディレクトリ(NSTemporaryDirectory()
)に抽出されます。
問題は、tableViewで抽出したコンテンツをどのようにナビゲートするかです。抽出されたzipファイルにフォルダーが含まれているとすると、それらをtableViewで表示できるはずです。実際には、フローはドリルダウンのようなものでなければなりません。
zipファイルを抽出することはできますが、問題は、でそれらに移動する必要があることUITableView
です。
これは私のdidSelectRowAtIndexPath:
部分です:
NSString *filePath = //filePath;
if ([[NSFileManager defaultManager]fileExistsAtPath:filePath]) {
NSLog(@"File exists at path: %@",filePath);
} else {
NSLog(@"File does not exists at path: %@", filePath);
}
NSString *tmpDir =NSTemporaryDirectory();
ZipArchive *zip = [[ZipArchive alloc] init];
BOOL result = NO;
if ([zip UnzipOpenFile:filePath]) {
//zip file is there
if ([zip UnzipFileTo:tmpDir overWrite:YES]) {
//unzipped successfully
NSLog(@"Archive unzip Success");
result= YES;
} else {
NSLog(@"Failure To Extract Archive, maybe password?");
}
} else {
NSLog(@"Failure To Open Archive");
}
if ([[NSFileManager defaultManager] fileExistsAtPath:tmpDir isDirectory:&isDir] && isDir) {
NSLog(@"Its Folder");
//Prepare to tableview.
RootViewController *rvController =[[RootViewController alloc]initWithNibName:@"RootViewController"bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:rvController animated:YES];
}
しかし、これは機能していません。tableViewのドキュメントディレクトリに同じ内容をプッシュしています。