拍摄快照时,显示出非常小的白色背景颜色

时间:2012-12-14 06:20:04

标签: iphone objective-c ios uiimageview uiimage

在一个视图控制器中有两个视图控制器,我正在拍摄快照,而在另一个视图控制器中,我显示已经选择的一次拍摄。

我正在研究图像,我需要拍摄快照,而我正在做这个我得到白色背景。我不知道为什么会这样?如下图所示(有三个图像视图,最初图像视图具有透明图像视图,然后是背景体图像视图和纹身图像视图。)

enter image description here

当我拍摄屏幕截图时,我隐藏了背景图像。 我将视图alpha设置为1.0f,我将视图背景颜色设置为清除颜色

输出屏幕截图是

enter image description here

我的代码是

    self.backgroundImgView.hidden=YES;
self.view.backgroundColor=[UIColor clearColor];
self.view.alpha=1.0f;
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
 UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
CGRect rect;
rect = CGRectMake(appDelegate.xFloat, appDelegate.yFloat, appDelegate.widthFloat, appDelegate.heightFloat);
    CGImageRef imageRef = CGImageCreateWithImageInRect([viewImage CGImage], rect);
UIImage *img = [UIImage imageWithCGImage:imageRef];
appDelegate.tattooImg=img;
CGImageRelease(imageRef);

1 个答案:

答案 0 :(得分:1)

在self.view上制作UIView类似持有人....然后在holderview上添加两个图像而不是self.view ....然后你将截图保存为holderview ...

相关问题