lundi 11 juillet 2016

How to detect if a textfield is empty in swift?


Hello despite the question name, this question requests a bit more insight. I want to know how to check if a textfield is empty but it must be able to detect this if contained text previously. Here is my current code func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { if textField == txtSitReach { if txtSitReach.text != nil { doneSitReachButton.enabled = true } else { doneSitReachButton.enabled = false } } else { print("whatever") }

Aucun commentaire:

Enregistrer un commentaire