Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example code for signature png image #14

Open
jotterbot opened this issue Sep 25, 2014 · 1 comment
Open

Example code for signature png image #14

jotterbot opened this issue Sep 25, 2014 · 1 comment

Comments

@jotterbot
Copy link

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!

@sebromero
Copy link

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 
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants