首页 > 其他 > 详细

写入文件

时间:2014-01-24 21:34:41      阅读:361      评论:0      收藏:0      [点我收藏+]

+ (NSString*)getPathByFileName:(NSString *)_fileName ofType:(NSString *)_type

{

    NSString* fileDirectory = [[[VoiceRecorderBaseVCgetCacheDirectory]stringByAppendingPathComponent:_fileName]stringByAppendingPathExtension:_type];

    return fileDirectory;

}

+ (NSString*)getCurrentTimeString

{

    NSDateFormatter *dateformat=[[[NSDateFormatter  alloc]init]autorelease];

    [dateformat setDateFormat:@"yyyyMMddHHmmss"];

    return [dateformat stringFromDate:[NSDate date]];

}

-(void)writeJPGToFile:(ChatMessageInfo *)_info

{

    NSData *imageData = [NSDatadataWithContentsOfURL:[NSURLURLWithString:_info.networkPath]];

    NSString *fileName = [ChatVoiceRecorderVC getCurrentTimeString];

    NSString *localFilePath = [ChatVoiceRecorderVC getPathByFileName:fileName ofType:@"jpg"];

    [imageData writeToFile:localFilePath atomically:NO];

    _info.localPath = localFilePath;

    

}

写入文件

原文:http://www.cnblogs.com/guligei/p/3532421.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!