Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 1.94 KB

README.md

File metadata and controls

51 lines (34 loc) · 1.94 KB

PinPad

View like iOS7 Lock screen

Dynamic count of input numbers and custom configuration. Works on iOS 5+.

How to use

  • Add the folder PinPad in your project folder

  • Add #import "PPPinPadViewController.h" in your viewController(in the .h file)

  • Implement the protocol PinPadPasswordProtocol in your class

  • This protocol has simple methods to control the pin pad

      - (BOOL)checkPin:(NSString *)pin; 	//required, validation with your configured code
      - (NSInteger)pinLength; 			//required, works like a data source of pin length
      - (void)pinPadSuccessPin;			//optional, when the user set a correct pin
      - (void)pinPadWillHide;				//optional, before the pin pad hide
      - (void)pinPadDidHide;				//optional, after pin pad hide
      - (void)userPassCode:(NSString *)newPassCode; //optional, set new user passcode
    
  • In your code, setup the controller as shown below:

      PPPinPadViewController * pinViewController = [[PPPinPadViewController alloc] init];
      pinViewController.delegate = self;
      pinViewController.pinTitle = @"Enter Passcode";	    pinViewController.isSettingPinCode = YES; // YES-input new passcode and confirmation 
      pinViewController.errorTitle = @"Passcode is not correct";
      pinViewController.cancelButtonHidden = NO; //default is False
      pinViewController.backgroundImage = [UIImage imageNamed:@"pinViewImage"]; //if you need remove the background set a empty UIImage ([UIImage new]) or set a background color
      pinViewController.backgroundColor = [UIColor darkGrayColor]; //default is a darkGrayColor
      
      [self presentViewController:pinViewController animated:YES completion:NULL];
    

Credits

License

PinPad is provided under the MIT license.