views:

28

answers:

1

I have a UIImageView displaying a picture that I took with the iPhone Camera. On top of that, I have a UITextView in which the user can type stuff that describes the picture.

I would like to create a combined image of the two views and send it to a server.

Anyone knows how I can do that (just creating the image. I know how to send it)

+1  A: 

If the UIImageView and UITextView are contained in another UIView. Or if you can create a UITextView and UIImageView on the same UIView you can then do this.

UIGraphicsBeginImageContext(myView.bounds.size);
[myView.layer renderInContext:UIGraphicsGetCurrentContext()];
viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Where myView is equal to the UIView containing the two.

You can also draw each one separately (by setting the frame appropriately) into myView to accomplish the same thing.

Jordan