Question : xcode perform action when return key pressed text field
Answered by : kristopher-wrobel
class SomeViewControllerClass : UIViewController, UITextFieldDelegate { override func viewDidLoad() { super.viewDidLoad() self.textField.delegate = self } func textFieldShouldReturn(textField: UITextField) -> Bool { //textField code textField.resignFirstResponder() //if desired performAction() return true } func performAction() { //action events }
}
Source : https://stackoverflow.com/questions/26288124/how-do-i-get-the-return-key-to-perform-the-same-action-as-a-button-press-in-swif | Last Update : Wed, 09 Sep 20