Last active
May 25, 2018 19:25
-
-
Save rickyngan/cf45148734d6ddc8800a to your computer and use it in GitHub Desktop.
LoginButton enable when both username and password textfields are filled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loginUserNameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) | |
loginUserPasswordTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) | |
@objc func textFieldDidChange(_ textField: UITextField) { | |
loginButton.enabled = loginUserNameTextField.text.length && loginUserPasswordTextField.text.length | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment