iOS 生成图片(知识点记录)

2020-03-31  本文已影响0人  咕噜_LSP
//最主要生成图片的方法
-(UIImage *)imageWithView:(UIView *)view
{
    CGFloat scale = [UIScreen mainScreen].scale;
    UIGraphicsBeginImageContextWithOptions(_scrollview.frame.size, NO, scale);
    [_scrollview.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    if (image != nil) {
           // 写到相册
           UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
     }
     return nil;
}
上一篇 下一篇

猜你喜欢

热点阅读