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

Change Border Color and text Color instantly #10

Open
taimur opened this issue Sep 1, 2021 · 4 comments
Open

Change Border Color and text Color instantly #10

taimur opened this issue Sep 1, 2021 · 4 comments

Comments

@taimur
Copy link

taimur commented Sep 1, 2021

I want to change borderColor and textColor instantly as soon user enters wrong OTP and then reset the colors. I have used these its not working. It works when user removes the character

otpView.borderColorTextField = app.theme.red
otpView.textColorTextField = app.theme.red

image

@sajidjutt7
Copy link

Getting same issue. Cannot assign all textfields colour at them same time.
otpView.borderColorTextField =.red only sets the border colour when we focus given to any textfield on touch.
Please fix it

@tapan-nathvani
Copy link

Hi, Any update on this? Even we need to achieve the same thing..

@sajidjutt7
Copy link

I copy the "DPOTPView.swift" class into my project. Then add this function in that class.

    public func setBorderColor(color: UIColor) {
        arrTextFields.forEach {(textField) in
            textField.borderStyle = .none
            textField.layer.masksToBounds = false
            textField.layer.shadowColor = color
            textField.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)
            textField.layer.shadowOpacity = 1.0
            textField.layer.shadowRadius = 0.0
        }
    }

Then use this in my swift class as.

txtOTPView.setBorderColor(color: .red)

@tapan-nathvani
Copy link

Thanks.. I used the same thing.

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

3 participants