ios 自定义键盘

时间:2022-02-06 03:18:16

由于项目需要,需要自定义键盘。ios系统键盘会缓存键盘输入,并保存在系统目录下的文件里,并且是明文存储,存在帐号密码泄漏风险。在别人代码基础上修改了下,美化了下界面,去掉了字符输入,加了点击特效,截图如下:

ios 自定义键盘

ios 自定义键盘

ios 自定义键盘

调用方法:

    LVKeyboard* keyBoard = [[LVKeyboard alloc] init];
keyBoard.delegate = self;
_tf_input.inputView = keyBoard;
_tf_input.delegate = self;
LVKeyboard是自定义键盘,将其设置为某个uitextfield对象的inputview,并且实现其代理:
/**
* 点击了文字或字符数字按钮
*/
- (void)keyboard:(LVKeyboard *)keyboard didClickTextButton:(UIButton *)textBtn string:(NSMutableString *)string;{
_tf_input.text = string;
}
/**
* 点击了删除按钮
*/
- (void)keyboard:(LVKeyboard *)keyboard didClickDeleteButton:(UIButton *)deleteBtn string:(NSMutableString *)string;{
_tf_input.text = string;
}

github地址:

https://github.com/dinner/LVKeyboard