Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

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
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #xcode #perform #action #return #key #pressed #text #field
ADD COMMENT
Topic
Name
5+4 =