背景画像を含む複数の画像を単一の画像に保存してから保存しようとしています。画像を平坦化する方法を見つけましたが、背景の上に追加した画像を平坦化すると正しい位置に表示されません。背景画像のサイズが異なり、異なる位置に表示されているようです。
UIGraphicsBeginImageContext(backGroundImage.image.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
//CGRect area= [self bounds];
CGRect area = CGRectMake(0, 0, backGroundImage.image.size.width, backGroundImage.image.size.height);
CGRect area2= CGRectMake(testImage.frame.origin.x, testImage.frame.origin.y, testImage.frame.size.width, testImage.frame.size.height);
//Need to flip images to the correct orientation
CGContextTranslateCTM(ctx, 0, area.size.height);
CGContextScaleCTM(ctx, 1, -1);
CGContextSetBlendMode(ctx, kCGBlendModeNormal);
//Drawing background first
CGContextDrawImage(ctx, area, backGroundImage.image.CGImage);
//Draw other images on top
//[[AccessoryManager sharedManager] SaveImages:ctx];
CGContextDrawImage(ctx, area2, testImage.image.CGImage);
//Creating one single image from context.
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum( newImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil );