スナップショットを撮っている1つのView Controllerに2つのView Controllerがあり、別のView Controllerには、選択したスナップショットを表示しています。
私は画像に取り組んでいます。これを行っている間にスナップショットを撮る必要があります。白い背景が表示されます。なぜこれが表示されるのかわかりませんか?以下の画像のように (3 つの画像ビューがあります。最初に画像ビュー、透過画像ビュー、次に背景ボディ画像ビュー、タトゥー画像ビューがあります。)
スクリーンショットを撮っているときは、背景画像を隠しています。ビューのアルファを 1.0f に設定し、ビューの背景色をクリア カラーに設定します。
出力スクリーンショットは
私のコードは
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);