/NumericKeypad

NumericKeypad for iPad

Primary LanguageObjective-C

What is this?

Numeric keypad

Subclass of UITextField - Numeric keypad for iPad.

Usage

  1. Drag the NumPadTextField foler into your project.
  2. You can use NumericKeypadTextField like this:

ViewController.h, ViewController.m

#import <UIKit/UIKit.h>
#import "NumericKeypadDelegate.h"

@interface ViewController : UIViewController <NumericKeypadDelegate>
@end

@implementation ViewController
#pragma mark - View lifecycle
- (void)loadView {
    [super loadView];
    // UITextField Subclass
    NumericKeypadTextField *numPadTextField = [[NumericKeypadTextField alloc] init];
    numPadTextField.numericKeypadDelegate = self;// delegate for saveActionFormTextField
    numPadTextField.placeholder = @"NUMPAD";
    numPadTextField.font = [UIFont systemFontOfSize:40];
    numPadTextField.frame = CGRectMake(50, 50, 200, 40);
    [self.view addSubview:numPadTextField];
    [numPadTextField becomeFirstResponder];
}

#pragma mark - NumericKeypad delegate
- (void)saveActionFormTextField:(UITextField *)textField {
    NSLog(@"text input %@", textField.text);
}

@end

NumericKeypad is designed in Interface Builder.

License

MIT License