本地文件

Posted oimm

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了本地文件相关的知识,希望对你有一定的参考价值。

 

 

本地文件

-(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;
}

 

以上是关于本地文件的主要内容,如果未能解决你的问题,请参考以下文章