Skip to content

Instantly share code, notes, and snippets.

@codeswimmer
Created January 2, 2013 20:06
Show Gist options
  • Select an option

  • Save codeswimmer/4437485 to your computer and use it in GitHub Desktop.

Select an option

Save codeswimmer/4437485 to your computer and use it in GitHub Desktop.
iOS: How To Join Two Images
(UIImage *)addImage:(UIImage *)image1 toImage:(UIImage *)image2 {
UIGraphicsBeginImageContext(image1.size);
// Draw image1
[image1 drawInRect:CGRectMake(0, 0, image1.size.width, image1.size.height)];
// Draw image2
[image2 drawInRect:CGRectMake(0, 0, image2.size.width, image2.size.height)];
UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resultingImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment