You can just align them in one UIView (I think it’s even off screen, but I haven’t checked yet) - and then just convert this UIView to UIImage with QuartzCode:
UIGraphicsBeginImageContext(myView.bounds.size); [myView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
Then turn this into a format - like PNG:
NSData *imageData = UIImagePNGRepresentation(image);
Then sending should not be too complicated.
EDIT Here is an extended example that you can also see for 3 images - you can, of course, use the interface builder and Outlets instead of writing everything, but you can copy it to try:
UIImageView *imgView1, *imgView2, *imgView3; imgView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image1"]]; imgView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image2"]]; imgView3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image3"]]; imgView1.frame = CGRectMake(0, 0, 50, 50); imgView2.frame = CGRectMake(50, 50, 100, 100); imgView3.frame = CGRectMake(100, 100, 200, 200); [referenceView addSubview:imgView1]; [referenceView addSubview:imgView2]; [referenceView addSubview:imgView3]; UIGraphicsBeginImageContext(referenceView.bounds.size); [referenceView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *finalImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); resultView = [[UIImageView alloc] initWithImage:finalImage]; resultView.frame = CGRectMake(0, 0, 320, 480); [self.view addSubview:resultView]; referenceView.hidden = YES;
Note I checked and the UIView should be accessible for drawing / visibility during the call to renderInContext (it may be off-screen, but it cannot be hidden or alpha = 0, because then it will be displayed invisible). So either set it aside on the screen or hide it immediately after drawing
source share