基本的思路:
1、获得文件的路径
2、管理文件的列表
方法如下:
//这句是获取你的完整目录 就是从根目录一直到Documents目录下的路径 类似xxx/xxxx/xxx/Documents/
NSString *docs = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] ;
//這句就是在上面獲取的路徑下加上你创建的文件夹的路径 类似xxx/xxxx/xxx/Documents/subdir/
NSString *subdir = [docs stringByAppendingPathComponent:@"subdir"];//subdir就是你创建的文件夹名
NSFileManager *manage=[NSFileManager defaultManager];
NSArray *files=[manage subpathsAtPath:filefile]; //filefile就是上方有大大說得那一個NSString *subdir
listOfItems=[[NSMutableArray alloc] init]; //接下來三行就都是tableview的一些
NSDictionary *dictionary=[NSDictionary dictionaryWithObject:files forKey:@"allxx"]; //@"allxx" 隨便你設,只是其他forkey都要一樣
[listOfItems addObject:dictionary];