标签:http 推断 删除 sso off 成功 配置 search ram
转载请标注来自:http://blog.csdn.net/u014202635/article/details/46863629
1.
选Devices
2.
3.
选中第二行
4.
保存在桌面
5.
右击选中显示包内容
6.
以上环境为x-code6.3.1
//----------------------------------------------------------------------------------------------------------------------------------------------------------------
//图片批量存储获取删除
#import <Foundation/Foundation.h>
@interface ImageSaveHelper :NSObject
/**
* 将图片数组以arrayName存储
*
* @param array 图片数组,数组元素是UIImage
* @param arrayName 存储图片文件名
*/
+(void)saveImageArray:(NSMutableArray *)array andArrayName:(NSString *)fileName;
/**
* 获取arrayName目录下全部图片
*
* @param arrayName 文件名
*
* @return 返回元素UIImage组成的数组
*/
+(NSMutableArray *)getImageArrayWithName:(NSString *)fileName;
/**
* 删除fileName目录下名称为imageName的文件
*
* @param imageName image名称
* @param fileName 目录名称
*
* @return 是否删除成功
*/
+(BOOL)deleteImageName:(NSString * )imageName withFileName:(NSString *)fileName;
@end
#import "ImageSaveHelper.h"
#import <UIKit/UIKit.h>
@implementation ImageSaveHelper
+(void)saveImageArray:(NSMutableArray *)array andArrayName:(NSString *)fileName{
NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString * path = [paths[0]stringByAppendingPathComponent:fileName];
if (![[NSFileManagerdefaultManager]fileExistsAtPath:path]){//推断createPath路径目录是否已存在。此处createPath为须要新建的目录的绝对路径
[[NSFileManagerdefaultManager] createDirectoryAtPath:pathwithIntermediateDirectories:YESattributes:nilerror:nil];//创建目录
}
for (int i =0 ; i < array.count; i++) {
NSString *filePath = [path stringByAppendingPathComponent:[NSStringstringWithFormat:@"%@%d.png",fileName, i]]; // 保存文件的名称
[UIImagePNGRepresentation(array[i])writeToFile: filePath atomically:YES];
}
}
+(NSMutableArray *)getImageArrayWithName:(NSString *)fileName{
NSMutableArray * imageArray = [NSMutableArrayarray];
NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString * path = [paths[0]stringByAppendingPathComponent:fileName];
if (![[NSFileManagerdefaultManager]fileExistsAtPath:path]){//推断createPath路径目录是否已存在,不存在直接返回
return imageArray;
}
//此目录下全部图片名称
NSArray *filesNameArray = [[NSFileManagerdefaultManager] subpathsOfDirectoryAtPath:patherror:nil];
if (filesNameArray && filesNameArray.count !=0 ) {
for (int i =0 ; i < filesNameArray.count; i++) {
UIImage * image = [UIImageimageWithContentsOfFile:[path stringByAppendingPathComponent:filesNameArray[i]]];
[imageArrayaddObject:image];
}
}
return imageArray;
}
+(BOOL)deleteImageName:(NSString * )imageName withFileName:(NSString *)fileName;
{
NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString * path = [paths[0]stringByAppendingPathComponent:fileName];
NSString * pathFull = [pathstringByAppendingPathComponent:[NSStringstringWithFormat:@"%@.png",imageName]];
if([[NSFileManagerdefaultManager] fileExistsAtPath:pathFull])//假设存在暂时文件的配置文件
{
return [[NSFileManagerdefaultManager] removeItemAtPath:pathFullerror:nil];
}
return NO;
}
@end
标签:http 推断 删除 sso off 成功 配置 search ram
原文地址:http://www.cnblogs.com/jzdwajue/p/6803508.html