在我的应用程序中,我有一张透明图像,现在当用户从照片库中选择一张图像时,该图像必须显示在透明图像上并制作为一张 uiiimage,以便用户可以邮寄或分享。我使用了以下代码,但是图像在透明图像上不正确
UIImage *backgroundImage = [UIImage imageNamed:@"iPhoneOverLay.png"];
UIGraphicsBeginImageContext(backgroundImage.size);
[backgroundImage drawInRect:CGRectMake(0, 0, backgroundImage.size.width, backgroundImage.size.height)];
[testImage drawInRect:CGRectMake(backgroundImage.size.width - testImage.size.width, backgroundImage.size.height - testImage.size.height, testImage.size.width, testImage.size.height)];
UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
这里 testImage 是从照片库中选择的或从相机中获取的