daily pastebin goal
89%
SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ViewController: UIViewController {
  2.  
  3.   @IBOutlet weak var txtFieldDemo: UITextField! {
  4.         didSet{
  5.             txtFieldDemo.delegate = self
  6.             txtFieldDemo.addTarget(self, action: #selector(textFieldDidChange(textField:)), for: .editingChanged)
  7.         }
  8.     }
  9. }
  10.  
  11. extension ViewController: UITextFieldDelegate{
  12.    func textFieldDidBeginEditing(_ textField: UITextField) {
  13.         textField.underlined()
  14.     }
  15.    
  16.     func textFieldDidEndEditing(_ textField: UITextField) {
  17.         textField.removeUnderline()
  18.     }
  19.    
  20.     @objc func textFieldDidChange(textField: UITextField){
  21.         textField.hideUnderline()
  22.         textField.underlined()
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top