zoukankan      html  css  js  c++  java
  • 写入文件

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

        

    }

  • 相关阅读:
    npm的使用
    js 数组去重
    js实现对象或者数组深拷贝
    js简单排序
    js判断类型
    鼠标移入移出事件
    jq中的attr和prop属性
    移动端底部被输入法顶起的解决办法
    vue中的number
    javascript要点(上)
  • 原文地址:https://www.cnblogs.com/guligei/p/3532421.html
Copyright © 2011-2022 走看看