Merge branch 'master' into fix/someBugs

This commit is contained in:
Alexey Gerasimov 2017-05-02 18:34:13 +03:00
commit 3c78300d7f
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
}
}