I have a UITextfield which has clear button enabled only while editing and it as shown in image attached.
What i need is when i tap on clear button of UITextfield it should do few custom activity along with clearing the UItextfield. As of now it only clears the UITextField only. It is not specific to clear/ dismiss keyboard.
Thanks
You can use this UITextFieldDelegate method. Don't forget to set delegate for the textfields.
func textFieldShouldClear(_ textField: UITextField) -> Bool {
print("text cleared")
//do few custom activities here
return true
}
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