SignatureXtra

Signature for iOS

Thiscapture signature on iPhone and iPad unique Xcode component adds signature capturing to your app in a few easy steps described below. The unlicensed version has all features and will show “Unlicensed” banners and pop-up.

Important: The license is using the App ‘Bundle Identifier’ (eg. company.com.appname – see step 6 below) and cannot be moved or shared between Apps. Please read the License Agreement before purchasing the component.

Features

 Supported Features
Unlicensed
Licensed
Swift and Objective-C
Xcode 5 and later
Capture to UIImage
Capture to JPEG/PNG
Capture to compressed NSString
Example code
No license banner
Change text (multi-language)
Remove buttons
Price
Free
$49
 Download/Order
See below

Installation

Follow these steps to add our signature component to your iPhone / iPad Xcode project. This guide both cover creating a new basic signature App and integration with an existing iOS project.

Step 1: On your Mac download and unzip SignatureXtra.zip (Objective-C) OR SignatureXtra64.zip (Swift)

ios-sign01

Step 2: Start Xcode and select ‘Create a new Xcode project’ (or load an existing project and skip to Step 6)
ios-sign02

Step 3: Select ‘Single View Application’
ios-sign03

Step 4: Enter your details, use new Language option to select either Swift or Objective-C, click Next and Create
ios-sign04

Step 5: Check the ‘Bundle Identifier’ – this string is later used for licensing
ios-sign06

Step 6: Drag/drop the two files from Step 1 into your project
ios-sign07

Step 7: Click ‘Finish’
ios-sign09

Step 8: For Objective-C follow Step 8A or Swift follow Step 8B

Step 8A: Open the ViewControler.m source file and enter this code:

#import "ViewController.h"
#import "SignatureXtra.h"

@interface ViewController ()

@end

@implementation ViewController
SignatureXtra *_signature;

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
_signature = [[SignatureXtra alloc] initWithFrame:CGRectMake(10,30,290,180) : self.view];
[self.view addSubview:_signature];
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (IBAction)Save:(id)sender {
UIImage* image = [_signature getAsImage];
[UIImagePNGRepresentation(image) writeToFile:@"signature.png" atomically:YES];
}
@end

Step 8B: Open the ViewControler.swift source file and enter this code:

import UIKit

class ViewController: UIViewController {
 var sign = SignatureXtra();
 
 override func viewDidLoad() {
 super.viewDidLoad()
 // Do any additional setup after loading the view, typically from a nib.
 sign = SignatureXtra(frame:CGRectMake(10,30,290,180), self.view);
 self.view.addSubview(sign)
 }

 override func didReceiveMemoryWarning() {
 super.didReceiveMemoryWarning()
 // Dispose of any resources that can be recreated.
 }
 @IBAction func Save(sender: AnyObject) {
 let image = sign.getAsImage();
 let documentsURL = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first!
 let fileURL = documentsURL.URLByAppendingPathComponent("signature.png")
 UIImagePNGRepresentation(image)?.writeToURL(fileURL, atomically: false)
 }
}

Step 8B2: Add bridging header file (Swift only):

  • Menu: File | New | File | iOS | Source | Header File
  • Save As: [PROJECT-NAME]-Bridging-Header.h
  • Check available Targets
  • Click ‘Save’
  • Targets | Build Settings |  Swift Compiler – Code Generation | Objective-C Bridging Header: $(SRCROOT)/[PROJECT-NAME]-Bridging-Header.h
  • Add this line to your new file [PROJECT-NAME]-Bridging-Header.h:
    #import "SignatureXtra.h"
    

Step 9: Add a button called ‘Save Signature To File’ in Interface Builder

ios-sign11

Step 10: Right click button and connect ‘Touch Up Inside’ event to ‘Save’ method from last step.
ios-sign14

Step 11: Select target device/simulator and click run
ios-sign16

Step 12: The signature component should now appear
ios-sign17

Step 13: Tap and sign
ios-sign18

Step 14: Selecting ‘Done’ or ‘Clear’ will display a “No license” pop-up
ios-sign19

Step 15: Click here to purchase a license for your App. Drag/drop your App license file into the project
ios-sign21

Step 16: Click run again to verify the component is now licensed
ios-sign23

For support, questions or suggestions please contact us.