xcode - How to add overlay to image picker in iOS -
i trying add overlay image taken imagepicker such frame, shown during snap taking. trying use following code:
self.picker = [[uiimagepickercontroller alloc] init]; self.picker.sourcetype = uiimagepickercontrollersourcetypecamera; self.picker.cameracapturemode = uiimagepickercontrollercameracapturemodephoto; self.picker.cameradevice = uiimagepickercontrollercameradevicerear; self.picker.showscameracontrols = no; self.picker.navigationbarhidden = yes; self.picker.toolbarhidden = yes; self.picker.wantsfullscreenlayout = yes; // insert overlay self.overlay = [[overlayviewcontroller alloc] initwithnibname:@"overlay" bundle:nil]; self.overlay.pickerreference = self.picker; self.picker.cameraoverlayview = self.overlay.view; self.picker.delegate = self.overlay; [self presentmodalviewcontroller:self.picker animated:no];
but helps when changing image picker skin. how can add , process overlay snapshot?
if need merge picture taken uiimageview contains image, here's useful snippet:
yourfile.h:
uiimage *combinedimage;
yourfile.m:
-(void)savepicture { // call method ibaction button // crop combined image taken picture cgrect rect = [_imagepreview bounds]; uigraphicsbeginimagecontextwithoptions(rect.size,yes,0.0f); // render both images, captured 1 camera , uiimageview on picture [__mycapturedimage.layer renderincontext:uigraphicsgetcurrentcontext()]; [_overlayimageview.layer renderincontext:uigraphicsgetcurrentcontext()]; combinedimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); _mycapturedimage.image = combinedimage; // automatically save image photo album (if want so) uiimagewritetosavedphotosalbum(combinedimage, nil, nil, nil); }
hope helps!
ps: have made nice template processes overlays images (which frames around images) here: http://codecanyon.net/item/picshape-frame-image-editor-full-app-template/7852895?ref=fvimagination
cheers!
Comments
Post a Comment