This article turns from http://blog.csdn.net/toddmi/article/details/8204102
[HTML]View Plaincopy
- = (Nscachesdirectory, Nsuserdomainmask, YES);
- = [Cachepaths objectatindex:0];
- }
[HTML]View Plaincopy
- = (Nscachesdirectory, Nsuserdomainmask, YES);
- = [Cachepaths objectatindex:0];
- }
[HTML]View Plaincopy
- = (DirName);
- = ;
- = [Nsfilemanager Defaultmanager];
- = [FileManager fileexistsatpath:imagedir isdirectory:&isdir];
- = ;
- = = Yes && = = yes))
- = [FileManager createdirectoryatpath:imagedir withintermediatedirectories:yes Attributes:nil Error:nil];
- = (DirName);
- = ;
- = [Nsfilemanager Defaultmanager];
- = [FileManager fileexistsatpath:imagedir isdirectory:&isdir];
- = ;
- = = Yes && = = yes)
- = [FileManager removeitematpath:imagedir error:nil];
- = ;
- = [Nsfilemanager Defaultmanager];
- = [FileManager Fileexistsatpath:directorypath isdirectory:&isdir];
- = ;
- = = Yes && = = yes)
- = [Uiimagepngrepresentation (image) Writetofile:[directorypath stringbyappendingpathcomponent:[nsstring stringwithformat:@ "%@.%@", ImageName, @ "PNG"]] options:nsatomicwrite Error:nil];
- = [UIImageJPEGRepresentation (image, 1.0) Writetofile:[directorypath stringbyappendingpathcomponent:[nsstring stringwithformat:@ "%@.%@", ImageName, @ "jpg"]] options:nsatomicwrite Error:nil];
- = ;
- = [Nsfilemanager Defaultmanager];
- = [FileManager Fileexistsatpath:directorypath isdirectory:&isdir];
- = = Yes && = = yes)
- = [DirectoryPath stringbyappendingstring:imagename];
- = [FileManager Fileexistsatpath:imagepath];
- = [NSData Datawithcontentsoffile:imagepath];
[HTML]View Plaincopy
- = (DirName);
- = ;
- = [Nsfilemanager Defaultmanager];
- = [FileManager fileexistsatpath:imagedir isdirectory:&isdir];
- = ;
- = = Yes && = = yes))
- = [FileManager createdirectoryatpath:imagedir withintermediatedirectories:yes Attributes:nil Error:nil];
- = (DirName);
- = ;
- = [Nsfilemanager Defaultmanager];
- = [FileManager fileexistsatpath:imagedir isdirectory:&isdir];
- = ;
- = = Yes && = = yes)
- = [FileManager removeitematpath:imagedir error:nil];
- = ;
- = [Nsfilemanager Defaultmanager];
- = [FileManager Fileexistsatpath:directorypath isdirectory:&isdir];
- = ;
- = = Yes && = = yes)
- = [Uiimagepngrepresentation (image) Writetofile:[directorypath stringbyappendingpathcomponent:[nsstring stringwithformat:@ "%@.%@", ImageName, @ "PNG"]] options:nsatomicwrite Error:nil];
- = [UIImageJPEGRepresentation (image, 1.0) Writetofile:[directorypath stringbyappendingpathcomponent:[nsstring stringwithformat:@ "%@.%@", ImageName, @ "jpg"]] options:nsatomicwrite Error:nil];
- = ;
- = [Nsfilemanager Defaultmanager];
- = [FileManager Fileexistsatpath:directorypath isdirectory:&isdir];
- = = Yes && = = yes)
- = [DirectoryPath stringbyappendingstring:imagename];
- = [FileManager Fileexistsatpath:imagepath];
- = [NSData Datawithcontentsoffile:imagepath];
iOS folder creation, deletion, picture in local save and load