Reputation: 25
My problem is that if I do my customization UITextField, then shouldChangeCharactersIn() method is not called, but if I do not apply to this customization, everything goes fine.
I use the library SkyFloatingLabelTextField
First file:
override func viewDidLoad() {
super.viewDidLoad()
emailField.setRegistrationFieldStyleWith(title: "E-mail")
emailField.delegate = self
}
Second file with Extensions:
func setRegistrationFieldStyleWith(title: String) {
let textField = SkyFloatingLabelTextField(frame: CGRect(x: 0, y: 0, width: 215, height: 40))
textField.placeholder = title
textField.title = title
textField.tintColor = overcastBlueColor
...
...
self.addSubview(textField)
}
Maybe who faced with this library? Or input processing method starts to behave differently, if the fields to customize?
Upvotes: 0
Views: 236
Reputation: 1712
Try this
override func viewDidLoad() {
super.viewDidLoad()
emailField.setRegistrationFieldStyleWith(title: "E-mail")
for view in emailField.subviews {
if view.isKind(of: UITextField.self) {
let textFieldView = view as! UITextField
textFieldView.delegate = self
}
}
}
Upvotes: 1