按钮样式可自定义,下载demo在PZXInputView可实现样式自定义
github地址:https://github.com/PZXforXcode/PZXSecurityKeyBoard
效果:

用法:
#import "PZXInputView.h"
@property (strong, nonatomic) PZXInputView *inputView;
_inputView = [[PZXInputView alloc]initWithFrame:CGRectMake(0, 0, 200, 260)];
_inputView.backgroundColor = [UIColor whiteColor];
_inputView.layer.borderWidth = 1;
_inputView.layer.borderColor = [UIColor lightGrayColor].CGColor;
_inputView.tf = self.tf;
self.tf.inputView = _inputView;
车牌号
//车牌号键盘用法
_carInput = [[LicensePlateInputView alloc]init];
__weak typeof(self)weakSelf = self;
_carInput.sendTextBlock = ^(NSString * _Nonnull plateString) {
weakSelf.CarTF.text = plateString;
};
[self.CarTF addTarget:self action:@selector(textChanged:) forControlEvents:UIControlEventEditingChanged];
self.CarTF.inputView = self.carInput;
//用这个方法把变换的值传回给input 为了切换键盘样式
-(void)textChanged:(UITextField *)textField{
NSLog(@"%@",textField.text);
//这里样将键盘值传回plateStr,让键盘切换
self.carInput.plateStr = textField.text;
}
网友评论