2

I have an image with a label that comes over it, but when I save photo to album, of course the label doesn't show up. How would I do this, I have search a lot, and nothing works.

Ali Zahedi
  • 41
  • 6

1 Answers1

5

I did a bit of research in other questions to come up with an answer for you (click here for the best and most detailed answer), but the short answer for you would be this:

If you do combine your label and image into one UIView object (let's call it myView), you can do something like this: something like this:

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

And the viewImage UIImage object would be what you save to the album.

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • Yup agreed. Create a new image for your particular screen frame. – Mrunal May 26 '12 at 06:33
  • I added a complete example for combining a label with an image for a toolbar button at the above link http://stackoverflow.com/a/7137429/981049 – Christopher Oct 22 '12 at 20:08