Search code examples
xcodexcode4storyboardxcode4.2

Dismissing the keyboard in a UIText Field when a Button is pressed in Xcode 4.2


Creating a login page in xcode 4.2

I have the users fill out information in a textfield.

I have the keyboard appear and I can get it dismiss when the user clicks the done button inside the keyboard.

I want the keyboard to dismiss when the user clicks on a button.

How do I go about this?


Solution

  • Just call

    [self.myTextField resignFirstResponder];
    

    in your action method from the button.