iOS 改变键盘颜色的代码

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

- (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];
            }
        }
    }
}