Search
 
SCRIPT & CODE EXAMPLE
 

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
    }
}
Comment

PREVIOUS NEXT
Code Example
Swift :: How to control the line spacing in UILabel 
Swift :: quartzcore framework pi chart 
Swift :: create alert in swift 
Swift :: swift corner radious of view controller 
Swift :: swipe left to go back iphone swift 
Swift :: swift struct field default value 
Swift :: loop key value swift 
Swift :: swift wait 5 seconds 
Swift :: Save structure in userdefaults ios swift 
Swift :: how to convert int to double in swiftui 
Swift :: add corner radius to uiview swift 
Swift :: replace character in swift 
Swift :: costume font size swift ui 
Swift :: swift replace all characters except numbers 
Swift :: sort array alphabetically swift 4 
Swift :: swift string to dictionary 
Swift :: most frequent element in array swift 
Swift :: check if string in array of string swift 
Swift :: How to hide view in swiftui 
Swift :: swift pretty print json 
Swift :: swift create an empty array 
Swift :: timer in swift stack overflow 
Swift :: swift extension Array where type 
Swift :: swift resource exceeds maximum size 
Swift :: two variable sum in swift 
Swift :: swift array in chunks 
Swift :: Log httpurlresponse swift 
Swift :: ios tableview hide empty cells 
Swift :: Swift Create enum variables 
Swift :: how to check if not running in debufgger swift 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =