Is there a way to detect that the return key was pressed on the keyboard without using textFieldDidEndEditing
. textFieldDidEndEditing
is also triggered if you for example perform a segue which dismisses the keyboard.
The below delegate is called when you press the return key.
func textFieldShouldReturn(textField: UITextField) -> Bool {
print("return pressed")
textField.resignFirstResponder()
return false
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With