Created
March 17, 2019 11:41
-
-
Save asisadh/3c605ee38fe17970542b6422d16de8ec to your computer and use it in GitHub Desktop.
ViewController
This file contains 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
class ViewController: UIViewController { | |
@IBOutlet weak var txtFieldDemo: UITextField! { | |
didSet{ | |
txtFieldDemo.delegate = self | |
txtFieldDemo.addTarget(self, action: #selector(textFieldDidChange(textField:)), for: .editingChanged) | |
} | |
} | |
} | |
extension ViewController: UITextFieldDelegate{ | |
func textFieldDidBeginEditing(_ textField: UITextField) { | |
textField.underlined() | |
} | |
func textFieldDidEndEditing(_ textField: UITextField) { | |
textField.removeUnderline() | |
} | |
@objc func textFieldDidChange(textField: UITextField){ | |
textField.hideUnderline() | |
textField.underlined() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment