Skip to content
Adds a Done and Cancel buttons to an iPhone Number Pad
Objective-C C Ruby
Find file
Failed to load latest commit information.
Example example project
DoneCancelNumberPadToolbar.h merge
DoneCancelNumberPadToolbar.m made closer to ios7 UI. This fixes #1
DoneCancelNumberPadToolbar.podspec Added podspec to this repo. Was already in Specs
LICENSE license file Update
sample.c Update sample.c

Adds Done and Cancel buttons to an iPhone Number Pad


ViewController Header

Add the include, delegate, and textfield to your header file

#import "DoneCancelNumberPadToolbar.h"

@interface ViewController : UIViewController <DoneCancelNumberPadToolbarDelegate>
@property (weak, nonatomic) IBOutlet UITextField *inputExampleTextField;


Attach the DoneCancelNumberPadToolbar to the textfield

- (void)viewDidLoad
    [super viewDidLoad];
    DoneCancelNumberPadToolbar *toolbar = [[DoneCancelNumberPadToolbar alloc] initWithTextField:inputExampleTextField];
    toolbar.delegate = self;
    inputExampleTextField.inputAccessoryView = toolbar;

Use the delegate methods as needed

-(void)doneCancelNumberPadToolbarDelegate:(DoneCancelNumberPadToolbar *)controller didClickDone:(UITextField *)textField
    NSLog(@"%@", textField.text);

-(void)doneCancelNumberPadToolbarDelegate:(DoneCancelNumberPadToolbar *)controller didClickCancel:(UITextField *)textField
    NSLog(@"Canceled: %@", [textField description]);

Something went wrong with that request. Please try again.