📅  最后修改于: 2022-03-11 15:01:00.654000             🧑  作者: Mango
Swift 5:
class YourClass: UIViewController, UITextFieldDelegate {
// will trigger when return button from keyboard is pressed
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
performAction(textField)
return true
}
private func preformAction(_ textField:UITextField){
//... code here ...
}
}