ios - Capture view with custom UIView in storyboard returning nothing? -
i using signature class add signatures ios application: https://github.com/jharwig/signaturedemo/blob/master/signaturedemo/nicsignatureview.h
i have signature view in storyboard form sheet, , able draw , , works....
however, want save signature image. that, doing this:
uiview *view = self.view; uigraphicsbeginimagecontextwithoptions(view.bounds.size, view.opaque, 0.0); [view.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage * img = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); uiimagewritetosavedphotosalbum(img, nil, nil, nil);
the image, however, white, without signature. assume becuase view not add programmatically, storyboard. however, addsubview
not adding view.
the signature class has built in method return uiimage, unsure how call view controller has view set in storyboard.
so question is, how can image?
add property view controller
@property (retain, nonatomic) iboutlet uiview* mysigview;
connect mysigview property uiview (nicsignatureview) in storyboard
trigger following action in view controller after hit save button:
nicsignatureview* sig = (nicsignatureview *)self.mysigview; uiimage* myimage = [sig signatureimage]; uiimagewritetosavedphotosalbum(myimage, nil, nil, nil);
do not forget import nicsignatureview.h in view controller
#import "nicsignatureview.h"
you can find signature in camera roll
Comments
Post a Comment