I have a UITableView
which lists the contents of my document directory. I have some zip files in that. If I touch a file in the UITableView
, the corresponding zip file is unzipped and extracted in a temporary directory (NSTemporaryDirectory()
).
The problem is how to navigate the contents which I extracted in a tableView. If suppose, the extracted zip file contains folders, I should able to view them in a tableView. Actually the flow should be like a drill-down.
I am able to extract the zip files, but problem is, have to navigate to them in a UITableView
.
This is my didSelectRowAtIndexPath:
part:
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];
}
But this is not working. It's pushing the same contents in the document directory in the tableView.