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

BackgroundColor of pinview indicator rectangle! #18

Open
wolf85-prog opened this issue Nov 7, 2020 · 1 comment
Open

BackgroundColor of pinview indicator rectangle! #18

wolf85-prog opened this issue Nov 7, 2020 · 1 comment

Comments

@wolf85-prog
Copy link

When filling in the pin code, the indicator will not be round but square.

@wolf85-prog wolf85-prog changed the title BackgroundColor of pinIndicator rectangle! BackgroundColor of pinview indicator rectangle! Nov 8, 2020
@ensarbayhan
Copy link

ensarbayhan commented Jan 28, 2021

Hi,

I have added two lines to drawing function like below and problem solved!

private func drawing(isNeedClear: Bool, tag: Int? = nil) { // Fill or cancel fill for indicators

    let results = pinIndicators.filter { $0.isNeedClear == isNeedClear }
    let pinView = isNeedClear ? results.last : results.first
    pinView?.isNeedClear = !isNeedClear
    
    pinView?.layer.cornerRadius = 0.5 * (pinView?.bounds.size.width)! // add these lines
    pinView?.clipsToBounds = true
    
    UIView.animate(withDuration: ALConstants.duration, animations: {
        pinView?.backgroundColor = isNeedClear ? .clear : .white
    }) { _ in
        isNeedClear ? self.pin = String(self.pin.dropLast()) : self.pincodeChecker(tag ?? 0)
    }
}

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

2 participants