How Do I Save What I have Drawn In A CGContext

后端 未结 4 847
余生分开走
余生分开走 2020-12-30 12:28

I have drawn into a CGContext of a UIView.

- (void)drawRect:(CGRect)rect { 
    [self drawInContext:UIGraphicsGetCurrentContext()]  
}

I wo

4条回答
  •  说谎
    说谎 (楼主)
    2020-12-30 12:46

    UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 
    NSData *imageData = UIImagePNGRepresentation(image);
    [imageData writeToFile:@"image.png"];
    

提交回复
热议问题