本文转自http://blog.csdn.net/toddmi/article/details/8204102

  1. = (NSCachesDirectory, NSUserDomainMask, YES);
  2. = [cachePaths objectAtIndex:0];
  3. }
  1. = (NSCachesDirectory, NSUserDomainMask, YES);
  2. = [cachePaths objectAtIndex:0];
  3. }
  1. = (dirName);
  2. = ;
  3. = [NSFileManager defaultManager];
  4. = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
  5. = ;
  6. == YES &&  == YES) )
  7. = [fileManager createDirectoryAtPath:imageDir withIntermediateDirectories:YES attributes:nil error:nil];
  8. = (dirName);
  9. = ;
  10. = [NSFileManager defaultManager];
  11. = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
  12. = ;
  13. == YES &&  == YES )
  14. = [fileManager removeItemAtPath:imageDir error:nil];
  15. = ;
  16. = [NSFileManager defaultManager];
  17. = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
  18. = ;
  19. == YES &&  == YES )
  20. = [UIImagePNGRepresentation(image) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"png"]] options:NSAtomicWrite error:nil];
  21. = [UIImageJPEGRepresentation(image, 1.0) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"jpg"]] options:NSAtomicWrite error:nil];
  22. = ;
  23. = [NSFileManager defaultManager];
  24. = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
  25. == YES &&  == YES )
  26. = [directoryPath stringByAppendingString : imageName];
  27. = [fileManager fileExistsAtPath:imagePath];
  28. = [NSData dataWithContentsOfFile : imagePath];
  1. = (dirName);
  2. = ;
  3. = [NSFileManager defaultManager];
  4. = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
  5. = ;
  6. == YES &&  == YES) )
  7. = [fileManager createDirectoryAtPath:imageDir withIntermediateDirectories:YES attributes:nil error:nil];
  8. = (dirName);
  9. = ;
  10. = [NSFileManager defaultManager];
  11. = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
  12. = ;
  13. == YES &&  == YES )
  14. = [fileManager removeItemAtPath:imageDir error:nil];
  15. = ;
  16. = [NSFileManager defaultManager];
  17. = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
  18. = ;
  19. == YES &&  == YES )
  20. = [UIImagePNGRepresentation(image) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"png"]] options:NSAtomicWrite error:nil];
  21. = [UIImageJPEGRepresentation(image, 1.0) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"jpg"]] options:NSAtomicWrite error:nil];
  22. = ;
  23. = [NSFileManager defaultManager];
  24. = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
  25. == YES &&  == YES )
  26. = [directoryPath stringByAppendingString : imageName];
  27. = [fileManager fileExistsAtPath:imagePath];
  28. = [NSData dataWithContentsOfFile : imagePath];

IOS之文件夹创建、删除,图片在本地的保存和加载的更多相关文章

  1. Java 基础【13】 文件(文件夹) 创建和删除

    使用 java.io.file 创建文件(文件夹),算是 java 最基础的知识,但实战项目中还是需要知晓细节. 比如 File 类中的 mkdir() 和 mkdirs() 的区别. JDK API ...

  2. Linux_文件及文件夹[创建][复制][移动][删除][重命名]

    一.文件/文件夹创建 1.文件的创建 touch , vi/vim/nano , ... 语   法: touch [-acfm][-d <日期时间>][-r <参考文件或目 录&g ...

  3. Java 基础【16】 文件(文件夹) 创建和删除

    使用 java.io.file 创建文件(文件夹),算是 java 最基础的知识,但实战项目中还是需要知晓细节. 比如 File 类中的 mkdir() 和 mkdirs() 的区别. JDK API ...

  4. python (10) 文件夹的创建与文件夹的删除

    有时需要在代码中对文件或者文件夹 进行删除,或者添加 导入的包:import os,shutil 新建文件夹 import os,shutil path = os.getcwd() #获得当前目录 # ...

  5. 个人永久性免费-Excel催化剂功能第17波-批量文件改名、下载、文件夹创建等

    前几天某个网友向我提出催化剂的图片功能是否可以增加导出图片功能,这个功能我一直想不明白为何有必要,图片直接在电脑里设个文件夹维护着不就可以了么?何苦还要把Excel上的图片又重新导出到文件夹中?这个让 ...

  6. 循环读取文件夹中的图片matlab代码

    参考:http://blog.csdn.net/guoxiaojie_415/article/details/21317323:http://blog.csdn.net/qikaihuting/art ...

  7. Android 遍历sdcard中指定文件夹下的图片(jpg,jpeg,png)

    File scanner5Directory = new File(Environment.getExternalStorageDirectory().getPath() + "/scann ...

  8. Linux下的文件夹创建命令使用实践

    [文章摘要] 本文以实际的C源程序为样例,介绍了Linux下的文件夹创建命令(mkdir)的用法.为相关开发工作的开展提供了故意的參考. [关键词] C语言  Linux  文件夹创建  makefi ...

  9. 【Linux】centos7中 root家目录中perl5文件夹无法删除问题解决

    由于新项目上线,安装了一些perl的一些包 但是发现,在/root下有一个perl5/的文件夹,删除后,重新登录又会出现,很是烦人,而且他还没有内容,就是一个空文件 那么着手搞掉他 环境:centos ...

随机推荐

  1. PHP判断数组下标有没有存在的方法

    PHP判断数组下标有没有存在的方法<pre>if(!empty($token['errcode'])){ print_r($token['errmsg']); exit();}</p ...

  2. winds添加静态路由

    如上图所示,wan口设备箱访问路由器栏口设备 route -p add 192.168.21.0 mask 255.255.255.0  192.168.0.176 -p 表示永久路由,重启后不丢失 ...

  3. mysql双主互为主从配置

    在使用双主互为主从的模式前提是互为主从的两个数据库,表的主键必须是自增的. 环境不多说了 ,多台mysql单实例或单台多实例都可以.多实例的配置请参考:https://www.cnblogs.com/ ...

  4. java多线程与线程并发五:多个线程访问共享对象和数据的方式

    本节的内容主要是对前面几节提到的线程间共享数据的方式做一个总结. 线程之间共享数据有以下几种方式: 1.如果每个线程执行的代码相同,可以使用同一个Runnable对象. 2.如果每个线程执行的代码不同 ...

  5. 网站搭建 - Linux虚拟系统 - 时间设置 - root密码修改 - 建站

    先试一下,如果不成的话,就不发表了. 下载织梦: 额,这个先还是不要下了. Linux是Apache + MySQL + PHP的套路,先下载吧,不摆图了,直接摆命令,我的是虚拟机,可能没有那么顺利. ...

  6. 如何在 PHP 和 Laravel 中使用 Traits

    事实上,PHP 作为一门编程语言存在的问题之一,就是你只能使用单继承.这意味着一个类只能从另一个类中继承.例如,可能希望从几个不同的类继承方法,以防止代码重复.在 PHP 5.4 中 一个新的语言特性 ...

  7. 理解Spark SQL(一)—— CLI和ThriftServer

    Spark SQL主要提供了两个工具来访问hive中的数据,即CLI和ThriftServer.前提是需要Spark支持Hive,即编译Spark时需要带上hive和hive-thriftserver ...

  8. yum 配置文件 以及 语法

    yum的配置文件 #vi /etc/yum.conf [main] cachedir=/var/cache/yum/$basearch/$releasever keepcache= debugleve ...

  9. pat 1120 Friend Numbers(20 分)

    1120 Friend Numbers(20 分) Two integers are called "friend numbers" if they share the same ...

  10. (二十九)golang--map

    map:是key-value数据结构,又称为字段或者关联数组,类似其它编程语言的集合: 基本语法:var 名称 map[键类型]值类型 key的类型可以是:bool.数字.string.指针.管道,还 ...