Featured post
ios - UINavigationController Drill Down with Table View -
i have uitableview
lists contents of document directory. have zip files in that. if touch file in uitableview
, corresponding zip file unzipped , extracted in temporary directory (nstemporarydirectory()
).
the problem how navigate contents extracted in tableview. if suppose, extracted zip file contains folders, should able view them in tableview. flow should drill-down.
i able extract zip files, problem is, have navigate them in uitableview
.
this didselectrowatindexpath:
part:
nsstring *filepath = //filepath; if ([[nsfilemanager defaultmanager]fileexistsatpath:filepath]) { nslog(@"file exists @ path: %@",filepath); } else { nslog(@"file not exists @ path: %@", filepath); } nsstring *tmpdir =nstemporarydirectory(); ziparchive *zip = [[ziparchive alloc] init]; bool result = no; if ([zip unzipopenfile:filepath]) { //zip file there if ([zip unzipfileto:tmpdir overwrite:yes]) { //unzipped nslog(@"archive unzip success"); result= yes; } else { nslog(@"failure extract archive, maybe password?"); } } else { nslog(@"failure open archive"); } if ([[nsfilemanager defaultmanager] fileexistsatpath:tmpdir isdirectory:&isdir] && isdir) { nslog(@"its folder"); //prepare tableview. rootviewcontroller *rvcontroller =[[rootviewcontroller alloc]initwithnibname:@"rootviewcontroller"bundle:[nsbundle mainbundle]]; [self.navigationcontroller pushviewcontroller:rvcontroller animated:yes]; }
but not working. it's pushing same contents in document directory in tableview.
you need use uinavigationcontroller handle drill down. each drill down new uitableviewcontroller.
you need second uitableviewcontroller subclass handle displaying files contained in zip. have nsstring property full path zip folder. uses list of files in directory data source.
add original tableview (controller) uinavigationcontroller's rootview @ startup. when tap tableview lists zip files, push onto uinavigationcontroller second uitableviewcontroller reference extracted files (a new folder?).
[uinavigationwcontroller pushviewcontroller:nexttableview animated:yes];
see legacy code example apple drilling down in uinavigationcontroller
. also, check out the docs on uinavigationcontroller apple.
- Get link
- X
- Other Apps
Comments
Post a Comment