- (void)wxNavViewDidSelectedRightBarItemWithTag:(NSInteger)tag {
//截取当前的一张图片的方法
UIGraphicsBeginImageContext(self.imageView.bounds.size);
UIGraphicsBeginImageContextWithOptions(self.imageView.bounds.size,NO,3.0);
[self.imageView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//保存到相册
if(image){
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);
}
}
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {
if (error) {
NSLog(@"保存失败");
}else {
NSLog(@"保存成功");
}
}
截图片和保存图片
最新推荐文章于 2020-05-09 10:14:04 发布