0

In one of my apps I am trying to combine two UIImageViews into a single UIImage. Bottom one is from the camera and the top one is something like a badge. The user can drag, rotate and scale the one at the top.

My question is, how can i save these two UIImageViews into a single UIImage at the end of all drag, rotate and scale operations?

Edit: I want to keep the original size of the bottom image.

frkncngz
  • 125
  • 2
  • 11

1 Answers1

1

This post : Saving UIView contents in iOS 4 with real size of the images inside (i.e. scale contentes up for save) shows how you can get a UIImage from any UIView.

Basically, you can adapt its solution, using a UIView container for your 2 UIImageViews.

Community
  • 1
  • 1
Vinzzz
  • 11,746
  • 5
  • 36
  • 42
  • What if I want to keep the original size of the bottom image? – frkncngz Nov 30 '11 at 19:41
  • if your 'top/badge' imageView fits into the other, you can add it as a subview (an UIImageView in another UIImageView), and use this method on the biggest/container UIImageView. And, when you're lost, don't forget to cut your 'big' problems in smaller ones : 1/ get a UIImage from a UIView 2/ resize that UIImage to the size of your camera's image (here's a useful link addressing both problems : http://www.icab.de/blog/2010/10/01/scaling-images-and-creating-thumbnails-from-uiviews/) – Vinzzz Dec 01 '11 at 11:36