digets fixde

This commit is contained in:
Grigory 2017-05-02 17:13:47 +03:00
parent 8a4d162529
commit 42e1a4a8c1
1 changed files with 13 additions and 0 deletions

View File

@ -57,6 +57,7 @@ open class BasePassCodeViewController: UIViewController {
fakeTextField.isSecureTextEntry = true
fakeTextField.keyboardType = .numberPad
fakeTextField.isHidden = true
fakeTextField.delegate = self
self.view.addSubview(fakeTextField)
return fakeTextField
}()
@ -237,3 +238,15 @@ extension BasePassCodeViewController: ConfigurableController {
open func localize() {}
}
extension BasePassCodeViewController: UITextFieldDelegate {
func textField(_ textField: UITextField,
shouldChangeCharactersIn range: NSRange,
replacementString string: String) -> Bool {
let invalid = CharacterSet(charactersIn: "0123456789").inverted
return string.rangeOfCharacter(from: invalid, options: [], range: string.startIndex..<string.endIndex) == nil
}
}