GithubHelp home page GithubHelp logo

willcode2surf / jbsignaturecontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xxhp/jbsignaturecontroller

0.0 2.0 1.0 163 KB

Allows you to present a view controller to the user allowing them to sign on the screen. After they've signed, the controller allows you to grab a UIImage of the signature for use or store. Built with ARC.

jbsignaturecontroller's Introduction

Features

  • Presents the user with a fully customizeable view for them to sign
  • Supports portrait and horizontal layout
  • Returns a UIImage of the signature, optionally cropped and centered to fit
  • Example shows how to save signature to a PNG file
  • Code is well-documented allowing for easy customization
  • Uses ARC
  • Free!

Usage

The code is well-documented so you should be able to tell what's going on rather quickly. There are two components: a UIViewController subclass that houses the protocol and handles events, and a UIView subclass that handles the touch events to draw the user's signature and return it as an image. You only need to work with the UIViewController subclass directly.

  1. Add the files contained in the JBSignatureControllerSource directory to your project.
  2. Design your "signature pad" background images and overwrite the default images.
  3. Initialize the JBSignatureController class:
JBSignatureController *signatureController = [[JBSignatureController alloc] init];
signatureController.delegate = self;
[self presentModalViewController:signatureController animated:YES];

Note: although shown as a modal view controller here, you're not limited to that use case. You could just as easily push the view controller onto a navigation stack.

Protocol Implementation

The JBSignatureControllerDelegate protocol should be implemented to retrieve the signature from the controller and also to dismiss the view controller once the user has indicated that they're finished signing. The following protocol definitions are available:

Called when the user clicks the confirm button (required):
-(void)signatureConfirmed:(UIImage *)signatureImage signatureController:(JBSignatureController *)sender;

Called when the user clicks the cancel button (optional):
-(void)signatureCancelled:(JBSignatureController *)sender;

Called when the user clears their signature or when clearSignature is called. (optional):
-(void)signatureCleared:(UIImage *)clearedSignatureImage signatureController:(JBSignatureController *)sender;

Example

A working example is provided in the project's source.

License

MIT/X11 Open Source License

Contributing

  1. Fork it!
  2. Make your changes in a new branch
  3. Submit a pull request

jbsignaturecontroller's People

Watchers

 avatar  avatar

Forkers

bit20062896

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.