Answers for "swift button return"

1

xcode perform action when return key pressed text field

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
    }
}
Posted by: Guest on September-02-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language