BSNumPad 1.0.2

BSNumPad 1.0.2

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Bogdan Stasjuk.



BSNumPad 1.0.2

Numeric keyboard in UIPopoverController for UITextField inspired by ZenKeyboard.

BSNumPadPopoverConotroller public properties and methods

@property(nonatomic, weak) id<BSNumPadPopoverConotrollerDelegate> padDelegate;
@property(nonatomic, assign) BSPopoverPosition padPosition;

- (instancetype)initWithTextField:(UITextField *)textField andTextFieldFormat:(BSTextFieldFormat)textFieldFormat andNextKey:(BOOL)nextKeyExist nextButtonTitle:(NSString *)nextButtonTitle;
- (void)dismissPopoverAnimated:(BOOL)animated onNextKeyPress:(BOOL)nextKeyPressed;

There are following Popover positions and TextField formats:

typedef NS_ENUM(NSUInteger, BSPopoverPosition)
{
    BSPopoverPositionLeft,
    BSPopoverPositionTop,
    BSPopoverPositionRight,
    BSPopoverPositionBottom,
};

typedef NS_ENUM(Byte, BSTextFieldFormat)
{
    BSTextFieldFormatFloat,
    BSTextFieldFormatDate,
    BSTextFieldFormatInteger
};

BSNumPadPopoverConotrollerDelegate protocol:

@optional
- (BOOL)isValidTextFieldText:(NSString *)text onNextKeyPress:(BOOL)nextPressed;
- (void)popoverWillAppear;
- (void)popoverDidDisappearOnNextPress:(BOOL)nextPressed;

isValidTextFieldText:onNextKeyPress: with result TRUE gives possibility to dismiss numpad view.

Initialization

    self.numPadPopoverConotroller = [[BSNumPadPopoverConotroller alloc] initWithTextField:textField andTextFieldFormat:BSTextFieldFormatFloat andNextKey:YES nextButtonTitle:nil];
    self.numPadPopoverConotroller.padDelegate = self;
    self.numPadPopoverConotroller.padPosition = BSPopoverPositionBottom;

NumPad appears on textFieldDidBeginEditing: message.

Numeric keyboard view:

Demo

Clone project and run it. You can find examples of usage at BSTestViewController.

Compatibility

This class has been tested back to iOS 6.0.

Installation

Cocoapods: pod 'BSNumPad'
Manual: Copy the BSNumPad folder in your project

Import header

#import "BSNumPadPopoverConotroller.h"

License

This code is released under the MIT License. See the LICENSE file for details.