-6

Basically I want to add an UIView on image and that image save to gallery. UIView contains some text and image, and that UIView add on image.

iOS Dev
  • 4,143
  • 5
  • 30
  • 58
Dev
  • 3,410
  • 4
  • 17
  • 16

1 Answers1

-1

Add (as subviews) all UI objects that you want to capture to one UIView, then make a screenshot of that view using the following piece of code:

CGRect rect = [captureView bounds];
UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f);
CGContextRef context = UIGraphicsGetCurrentContext();
[captureView.layer renderInContext:context];   
UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext(); 

Then you can save the obtained UIImage to gallery:

UIImageWriteToSavedPhotosAlbum(capturedImage, nil, nil, nil);
iOS Dev
  • 4,143
  • 5
  • 30
  • 58