我想知道如何将2 uiimage合并为1?我想将最终产品保存到库中.为了保存图像,我正在使用UI按钮.这是我如何保存UI
Imageview.image的片段.
-(IBAction)getPhoto:(id)sender { UIImage* imageToSave = imageOverlay.image; UIImageWriteToSavedPhotosAlbum(imageToSave,nil,nil); }
我在网上看了一下UIGraphicsBeginImageContext.找到了一个例子,但我无法理解如何将它实际应用到我的.这是我到目前为止所得到的.
- (UIImage*)addImage:(UIImage *)image secondImage:(UIImage *)image2 { UIGraphicsBeginImageContext(image.size); [image drawInRect:CGRectMake(0,image.size.width,image.size.height)]; [image2 drawInRect:CGRectMake(10,10,image2.size.width,image2.size.height) blendMode:kCGBlendModeNormal alpha:1.0]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage; }
现在我有2个UIImageviews,它们是imageOverlay.image和imageView.image.如果我使用上面的方法如何将返回值分配给UIImageWriteToSavedPhotoAlbum?希望有人能指出我正确的方向.
非常感谢.