How to create a UIImage programmatically with contents
ios, objective-c, uiimage
Solution
This will help you
UIImage *image1 = [UIImage imageNamed:@"image1.png"];
UIImage *image2 = [UIImage imageNamed:@"image2.png"];
CGSize newSize = CGSizeMake(width, height);
UIGraphicsBeginImageContext( newSize );
[image1 drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
[image2 drawInRect:CGRectMake(0,0,newSize.width,newSize.height) blendMode:kCGBlendModeNormal alpha:0.8];
UIImage *finalImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Problem
I'm trying to create a `UIImage` with some contents in it. In my app, the user will be able to see an image by tapping on different things, and the parts of the image they change would be based on what they tap. I'm doing this by layering `UIImages` on top of each other. How would I be able to create a `UIImage` (for the user to export) that takes the same method, by layering images on top of each other? Thanks :)