Created
April 20, 2018 18:17
-
-
Save MertCelik/a3fb63f2d660a1690369d6813ae4261f to your computer and use it in GitHub Desktop.
How to dismiss keyboard in iOS
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
import UIKit | |
class RegistrationViewController: UIViewController, UITextFieldDelegate { | |
@IBOutlet weak var firstNameField: UITextField! | |
@IBOutlet weak var lastNameField: UItextField! | |
override func viewDidLoad(){ | |
super.viewDidLoad() | |
configurations() | |
} | |
fileprivate func configurations(){ | |
firstNameField.delegate = self | |
lastNameField.delegate = self | |
} | |
internal func textFieldShouldReturn(_ textField: UITextField) -> Bool { | |
self.view.endEditing(true) | |
return true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment