-1

I currently am trying to dismiss the keyboard from the previous text field when clicking a button. I currently have one method working to dismiss the keyboard, although it only dismisses it when the user taps away.

  • 1
    Possible duplicate [Close iOS Keyboard by touching anywhere using Swift](https://stackoverflow.com/questions/24126678/close-ios-keyboard-by-touching-anywhere-using-swift). You might also consider doing some research into "resginFirstResponder" – MadProgrammer Jul 24 '18 at 01:40
  • And may be also [Best way to dismiss Keyboard in a View Controller iOS (Swift)](https://medium.com/@KaushElsewhere/how-to-dismiss-keyboard-in-a-view-controller-of-ios-3b1bfe973ad1) – MadProgrammer Jul 24 '18 at 01:44
  • self.view .endEditing(true) – Sarabjit Singh Jul 24 '18 at 07:27

1 Answers1

0

you can call this method every time you wanted to resign the

self.view.endEditing(true)

and you can dismiss keyboard from every textfield you wanted , you can call this method :

myTextField.resignFirstResponder()
Mohammad Reza Koohkan
  • 1,656
  • 1
  • 16
  • 36