我正在尝试使用搜索显示控制器搜索任何文件。但是文件内部文件没有显示在tableview中。这意味着不会检索子文件夹/文件。
获取文件和文件夹我正在使用此代码。我不明白为什么子文件没有显示。
if(metadata.isDirectory)
{
marrFiles = [[NSMutableArray alloc]init];
for (DBMetadata *dbObject in metadata.contents)
{
if (!dbObject.isDirectory)
{
NSString *fileName = [dbObject.path lastPathComponent];
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
NSString *stringSize = [NSString stringWithFormat:@"%@",[dbObject humanReadableSize]];
NSDate *modificationDate = [dbObject lastModifiedDate];
NSString *dateString = [dateFormatter stringFromDate:modificationDate];
dateString = [dateString createdTimeString];
[dict setValue:fileName forKey:@"File"];
NSString *stringInfo = [NSString stringWithFormat:@"%@ %@",stringSize,dateString];
[dict setValue:stringInfo forKey:@"Size"];
[dict setValue:@"No" forKey:@"isSelected"];
[marrFiles addObject:dict];
}
else
{
NSString *fileName = [dbObject.path lastPathComponent];
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setValue:@"No" forKey:@"isSelected"];
[dict setValue:fileName forKey:[NSString stringWithFormat:@"File"]];
[marrFiles addObject:dict];
}
}
[tblDropbox reloadData];
}
else
{
NSMutableArray *listFile=[NSMutableArray array];
for (DBMetadata *file in metadata.contents) {
[listFile addObject:file.filename];
}
}
[MBProgressHUD hideHUDForView:self.view animated:YES];