-(void)saveHistory
{
UIImage *image = [self captureImageFromView:self.view];
ALAssetsLibrary *library = [ALAssetsLibrary new];
NSData *date = UIImageJPEGRepresentation(image, 1.0);
[library writeImageDataToSavedPhotosAlbum:date metadata:nil completionBlock:nil];
}
-(UIImage *)captureImageFromView:(UIView *)view
{
CGRect screenRect = [view bounds];
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ref = UIGraphicsGetCurrentContext();
[view.layer renderInContext:ref];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
iOS截图
最新推荐文章于 2021-10-29 15:29:38 发布