本地文件

 

 

本地文件

-(NSMutableDictionary *)localFile {
    NSString *path = [[NSBundle mainBundle] bundlePath];
    NSFileManager *fm = [NSFileManager defaultManager];
    NSDirectoryEnumerator *dirEnum = [fm enumeratorAtPath:path];
    NSString *fileName;
    NSMutableDictionary *R = [NSMutableDictionary dictionary];
    while (fileName = [dirEnum nextObject]) {
        NSLog(@"短路径:%@", fileName);
        NSLog(@"全路径:%@", [path stringByAppendingPathComponent:fileName]);
        if ([fileName hasSuffix:@".png"]) {
            NSString *key = [fileName componentsSeparatedByString:@"/"].lastObject;
            [R setObject:fileName forKey:key];
        }
    }
    return R;
}

 

posted @ 2018-10-24 17:48  OIMMZC  阅读(615)  评论(0编辑  收藏  举报