Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

验证码输入错误的时候,需要把下划线 由 黑色 变成 红色。现有api没有找到可行办法。 #60

Open
lovivid opened this issue Nov 7, 2023 · 1 comment

Comments

@lovivid
Copy link

lovivid commented Nov 7, 2023

有个需求。

当验证码输入错误的时候,需要把下划线 由 黑色 变成 红色。

现有api没有找到可行办法。

@lovivid
Copy link
Author

lovivid commented Nov 7, 2023

目前我在不修改源码的情况下,如下可以实现需求,但是方法有点挫

// 向下遍历,找到 CRLineView 变色
- (void)loop2FindCRLineView:(UIView*)view markRed:(BOOL)markRed{
    if([view isKindOfClass:CRLineView.class]) {
        if (markRed) {
            ((CRLineView*)view).underlineColorNormal = 红色;
            ((CRLineView*)view).underlineColorSelected = 红色;
            ((CRLineView*)view).underlineColorFilled = 红色;
            ((CRLineView*)view).lineView.backgroundColor = 红色;
        } else {
            ((CRLineView*)view).underlineColorNormal = 灰色;
            ((CRLineView*)view).underlineColorSelected = 黑色;
            ((CRLineView*)view).underlineColorFilled = 黑色;
            ((CRLineView*)view).lineView.backgroundColor = 黑色;
        }
        return;
    }
    
    for (UIView* sub in view.subviews) {
        [self loop2FindCRLineView:sub markRed:markRed];
    }
}

- (void)changeBoxInputLineRed {
    [self loop2FindCRLineView:_boxInputView markRed:YES];
}

- (void)changeBoxInputLineBlack {
    [self loop2FindCRLineView:_boxInputView markRed:NO];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant