so i make this func which is triggered when 2 textfield reach minimum amount of text count will make the button is enabled.
it works on ios 13 and above but it wont work on ios 12….which i dont know how and why it wont work
so basicly my textFieldDidChangeSelection doenst trigger anything when i type on my textfield…..its not working on ios 12 but its working on 13 an above
i try to put some print on textFieldDidChangeSelection but nothing is print on console
this is my code
//this is my func code
func buttonReady() {
if phoneNumberTextField.text!.count > 8 && textPinTextField.text!.count == 6{
loginButton.isUserInteractionEnabled = true
loginButton.backgroundColor = UIColor.init(string: COLOR_RED)
loginButton.setTitleColor(UIColor.white, for: .normal)
print("ahaaaa 🏌🏻")
} else {
loginButton.isUserInteractionEnabled = false
loginButton.backgroundColor = UIColor.init(string: COLOR_GREY_BUTTON)
loginButton.setTitleColor(UIColor.init(string: COLOR_GREY_TEXT), for: .normal)
print("hmmmm 🤔")
}
}
and i use that func in here
func textFieldDidChangeSelection(_ textField: UITextField) {
if textField == phoneNumberTextField {
buttonReady()
}
if textField == textPinTextField {
buttonReady()
}
}
and here
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
buttonReady()
hideKeyboardWhenTappedAround()
}
and im using SkyFloatingLabelTextFIeld for my custom textfield
i still dont get it why that func couldnt work on ios12 while it works on ios 13 and above
2
Answers
Same question
You can try this
than
Check out UITextField.h, you’ll see:
textFieldDidChangeSelection
is only available on iOS 13.0 and greater.