0

I have a transparent image and a UIView below and same size with the image. Everytime I want to change color of the image, I just set color to the UIView. My problem is how can I save the decorated image to the photo library? Since the color/decoration comes from the UIView below, not the image.

Thanks guy for reading.

Q.u.a.n.g L.
  • 1,564
  • 1
  • 12
  • 27

1 Answers1

1

You can get screen shot of a view by this method:

+ (UIImage *) getScreenShot : (UIView *) view{
    UIGraphicsBeginImageContext(view.frame.size);
    [view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return screenImage;
}

Pass your baseView in this method it'll return the decorated image.

rptwsthi
  • 10,094
  • 10
  • 68
  • 109
  • It works but the image exported seems not in high quality. Do you know how to raise its quality? – Q.u.a.n.g L. May 21 '13 at 08:53
  • I searched "draw hight resolution image UIGraphicsBeginImageContext" on google and found http://stackoverflow.com/questions/4334233/how-to-capture-uiview-to-uiimage-without-loss-of-quality-on-retina-display response – rptwsthi May 21 '13 at 09:23