iOS image生成图片

当我们使用二维码的时候,通常不只这么简单,会让我们生成png 、JPG等图片类型 。
如下:

//设置沙盒路径
针对于返回的UIIMage 的类型

定义全局的int 类型的i;
    NSString* path = [NSString stringWithFormat:@"%@/Documents/myDrawing%d.png",NSHomeDirectory(),i];
    BOOL a = [UIImagePNGRepresentation (self.imageV.image) writeToFile:path atomically:YES];
    if (a)
    {
        NSLog(@"%@",path);
        NSLog(@"保存至沙盒完毕");
    }

    i++;

猜你喜欢

转载自mmm0m.iteye.com/blog/2217260