I am using this signature class to add signatures to my iOS application: https://github.com/jharwig/SignatureDemo/blob/master/SignatureDemo/NICSignatureView.h
I have the signature view in a storyboard form sheet, and I am able to draw and everything and it works....
However, I want to save the signature as an image. To do that, I am 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, is all white, without the signature. I assume that is becuase the view is not add programmatically, but with a storyboard. However, the addSubview
is not adding the view.
The signature class also has a built in method to return a UIImage, but I am unsure how to call this from a view controller that has the view set in a storyboard.
So my question is, how can I get the image?