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 }