IT虾米网

iOS 改变键盘颜色的代码

leader 2018年06月24日 手机开发 900 0
- (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]; 
            } 
        } 
    } 
} 

评论关闭
IT虾米网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!