Friday, January 18, 2013

How to Hide Keyboard in xCode/swift

Objective C:
Just declare the function as mentioned below:

Declare function for TextHolder in "Did End Exit" event as below: in (.h) file

- (IBAction)editingCompleted:(id)sender;

now define function in (.m) file as below:

- (IBAction)editingCompleted:(id)sender {
    [sender resignFirstResponder]; // Here sender is the TextHolder, which text you can print also as sender.text

Always use resignFirstResponder with TextHolder, for which keyboard needs to hide.

Declare function for TextHolder for "Did End On Exit"

@IBAction func editingCompleted(sender: UITextField) {


No comments:

Post a Comment