Example code for signature png image
jotterbot opened this issue · comments
Hello,
I am wondering if you could provide some example code in order to save the signature as a png.
I know that you have a method to do that in signatureImage but my problem is that I don't know how to get the signature to save, for example linking at the press of a button.
This is probably basic obj-c that I just don't understand. But if I use something like:
- (void)drawImage2
{
PPSSignatureView *sig = [[PPSSignatureView alloc]init];
UIImage *image2 = [sig signatureImage];
CGRect imageRect = CGRectMake(10, 10, 600, 600);
[image2 drawInRect:imageRect];
}
I get a blank image 0 x 0 px. I guess i need to know how to target the existing signature in the GLKView.
Any help would be greatly appreciated.
Cheers!
Your code looks basically ok to me. You would first want to setup a PPSSignatureView for example like this (untested):
- (void)viewDidLoad {
[super viewDidLoad];
PPSSignatureView* signatureView = [[PPSSignatureView alloc] initWithFrame:CGRectMake(10, 10, 600, 600)];
[self.view addSubview:signatureView];
}
-(void)getSignature {
PPSSignatureView* signatureView = self.view.subviews.firstObject;
UIImage* signature = [signatureView signatureImage];
//... e.g. save image to disk
}