美文网首页
图片压缩

图片压缩

作者: 06f43b0b52f7 | 来源:发表于2017-10-19 17:26 被阅读15次

    (void)saveImage:(UIImage *)tempImage WithName:(NSString *)imageName

    {

    NSData* imageData = UIImagePNGRepresentation(tempImage);

    NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    NSString* documentsDirectory = [paths objectAtIndex:0];

    // Now we get the full path to the file

    NSString* fullPathToFile = [documentsDirectory stringByAppendingPathComponent:imageName];

    // and then we write it out

    [imageData writeToFile:fullPathToFile atomically:NO];

    }

    相关文章

      网友评论

          本文标题:图片压缩

          本文链接:https://www.haomeiwen.com/subject/xchpuxtx.html