截图片和保存图片

来源:互联网 发布:cf一直出现网络异常 编辑:程序博客网 时间:2024/04/28 08:53
- (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(@"保存成功");    }}
0 0
原创粉丝点击