因为项目需求,简单的弄了个自定义数字键盘
需要的自取,大神勿喷
使用也很简单
#import "JKNumberTextField.h"
//代理<JKNumberTextFieldDelegate>
JKNumberTextField *textField = [[JKNumberTextField alloc] init];
textField.JKDelegate = self;
/** 创建用init,代理注意不要写成delegete了
* 继承于YUTextField,设置属性就好,暂不支持xib和sb
*/
textField.frame = CGRectMake(50, 200, 200, 30);
textField.borderStyle = UITextBorderStyleRoundedRect;
[self.view addSubview:textField];
//实现代理方法即可
/**点击收键盘时调用*/
- (void)textFieldDidComplete:(JKNumberTextField *)textField andText:(NSString *)text {
[textField resignFirstResponder];
}
/**值变化时调用*/
- (void)textFieldDidChangeAnyValue:(JKNumberTextField *)textField andText:(NSString *)text {
}