IOS changes the keyboard color code

  • 2020-05-06 11:42:54
  • OfStack

IOS changes the color of the keyboard code

The keyboard colors of iPhone and iPod touch can be changed by code to better match the interface style of App. Here is the code to change the color of iPhone keyboard.

1. Only Number Pad and Phone Pad are effective 2. Set Appearance to Alert


- (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"]){
                v.backgroundColor = [UIColor redColor];
            }
        }
    }
}

The above is all the content of this article, I hope you can enjoy it.


Related articles: