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.
Asked
Active
Viewed 72 times
-6
-
not getting question! – kb920 Feb 04 '16 at 12:09
-
you mean that you want to save image on gallery having a combination of text and image right? – kb920 Feb 04 '16 at 12:11
-
combination of capture uiview and image – Dev Feb 04 '16 at 12:18
-
you have to use uiimageview not uiimage – kb920 Feb 04 '16 at 12:21
-
you can't add look here http://stackoverflow.com/questions/2415561/apple-interface-builder-adding-subview-to-uiimageview – kb920 Feb 04 '16 at 12:22
1 Answers
-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