iOS - 图片合成

 1 - (UIImage *)addImage:(UIImage *)image1 withImage:(UIImage *)image2 rect1:(CGRect)rect1 rect2:(CGRect)rect2 {
 2     CGSize size = CGSizeMake(rect1.size.width+rect2.size.width, rect1.size.height);
 3     
 4     UIGraphicsBeginImageContext(size);
 5     
 6     [image1 drawInRect:rect1];
 7     [image2 drawInRect:rect2];
 8     
 9     UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
10     
11     UIGraphicsEndImageContext();
12     
13     return resultingImage;
14 }
原文地址:https://www.cnblogs.com/mo-shou/p/4035127.html