BSNumPad 1.0.2

BSNumPad 1.0.2

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2014年12月

Bogdan Stasjuk维护。



BSNumPad 1.0.2

受ZenKeyboard启发的Numeric键盘,用于UITextField的UIPopoverController。

BSNumPadPopoverConotroller公共属性和方法

@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;

以下为Popover位置和TextField格式:

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

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

BSNumPadPopoverConotrollerDelegate协议

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

isValidTextFieldText:onNextKeyPress:在输入TRUE后将关闭数字键盘视图。

初始化

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

数字键盘出现在textFieldDidBeginEditing:消息上。

数字键盘视图

演示

克隆项目并运行。您可以在BSTestViewController中找到使用示例。

兼容性

这个类已测试回iOS 6.0。

安装

Cocoapods: pod 'BSNumPad'
手动: 将BSNumPad文件夹复制到您的项目中

导入头文件

#import "BSNumPadPopoverConotroller.h"

许可证

此代码根据MIT许可证发布。有关详细信息,请参阅LICENSE文件。