ios - UITextfield not removing the icon even after the textfield is cleared -


i have form 2 textfields , want validate type. example: have email textfield , start typing tells me whether email has been used or not. if used shows 'x' icon in textfield , if it's not shows 'check mark'. validation works fine. problem facing when try clear textfield pressing delete button(not holding down) clears textfield , shows no icon because it's empty. if try clear textfield holding down delete button, icon not disappear. here's code:

  emailavailable.get(["email": newstring], handler: {(result: [basemodel]?,  error: nserror?) in                 if let available = result as? [emailavailable] {                     self.emailimageview.image = available[0].available ? uiimage(named: "success") : uiimage(named: "failed")                 } else {                     self.emailimageview.image = uiimage(named: "failed")                 }             }) 

i making api call here check whether email valid or not. note: validation works fine.

enter image description here

the above image shows check mark after textfield cleared , happens when hold down delete button. appreciated, thanks!


Comments

Popular posts from this blog

ios - Is 'init' forbidden as *part* of a variable name? -

file - Python: AttributeError: 'str' object has no attribute 'readlines' -

c# - Get the Class name in a class with atribute inside a attribute method -