dongdong3344 / customkeyboard Goto Github PK
View Code? Open in Web Editor NEW仿写工商银行的安全键盘,另外实现点击键盘放大显示的动画效果。
仿写工商银行的安全键盘,另外实现点击键盘放大显示的动画效果。
按钮点击事件不会使背景颜色发生改变,所以你在点击空格键的时候加了修改按钮背景颜色的方法,这时已经点击了按钮,但是不会调用点击事件
所以解决方案是,在遍历子view的时候加上就可以了
LDDKeyboardView.m
文件下
//设置各个键盘View上的按钮点击方法
-(void)setupButtonClickWithView:(UIView*)view{
[view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
//按钮类型是CYRKeyboardButton,则点击按钮时有extension
if ([obj isKindOfClass:[CYRKeyboardButton class]]) {
CYRKeyboardButton *cyrButton=(CYRKeyboardButton*)obj;
cyrButton.input=cyrButton.currentTitle;
//cyrButton.inputOptions=@[@"A",@"B",@"C",@"D"];
[cyrButton addTarget:self action:@selector(keyboardBtnClick:) forControlEvents:UIControlEventTouchUpInside];
//按钮类型是UIButton,直接执行点击方法
}else if ([obj isKindOfClass:[UIButton class]]){
UIButton *button=(UIButton*)obj;
[button addTarget:self action:@selector(keyboardBtnClick:) forControlEvents:UIControlEventTouchUpInside];
#pragma mark - 此处为新增代码
//设置空格按钮状态
if (button.tag == LDDButtonTypeSpace) {
[button addTarget:self action:@selector(backgroundHighlighted:) forControlEvents:UIControlEventTouchDown];
//需要再将按钮置为正常背景色
[button addTarget:self action:@selector(backgroundNormal:) forControlEvents:UIControlEventTouchUpOutside];
}
}
}];
}
同时感谢大佬贡献的代码
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.