IOS code to change keyboard color
The keyboard colors of iPhone and iPod touch can actually be changed through code, which can better match the App's interface style. Below is the code to change the iPhone keyboard color.
1. Only the number keyboards, Number Pad and Phone Pad, have effect.
2. Set Appearance to Alert
Copy the codeThe code is as follows:
- (void)textFieldDidBeginEditing:(UITextField *)textField{
NSArray *ws = [[UIApplication sharedApplication] windows];
for(UIView *w in ws){
NSArray *vs = [w subviews];
for(UIView *v in vs){
if([[NSString stringWithUTF8String:object_getClassName(v)] isEqualToString:@"UIPeripheralHostView"]){
= [UIColor redColor];
}
}
}
}
The above is the entire content of this article, I hope you like it.