我希望将背景(UIImageView)与上层的 UIView(MyView)结合起来,然后对合并后的图像进行截图。我正在使用下面的代码,但背景完全覆盖了我的 UIView ......请问有什么建议吗?
UIImageView *ViewToBeAddedAsBackground = BackgroundImageView;
ViewToBeAddedAsBackground.frame = CGRectMake(0,0,770,410);
[MyView addSubview:ViewToBeAddedAsBackground];
UIGraphicsBeginImageContext(MyView.frame.size);
[MyView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *MyView_IMAGE = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(MyView_IMAGE, nil, nil, nil);