Vivek
Vivek

Reputation: 382

How to hide the soft keyboard in iPad

I have a navigation controller The first view is for Sign In. There are two text fields for username and password and two buttons for Login and Create Account

If user taps the username or password text fields, soft keyboard pops up. After that if user taps, Create Account, user is navigated to the second view where he has to make a category selection(no input fields. just radio buttons)

But the soft keyboard does not go away.

I even tried this -[UIViewController disablesAutomaticKeyboardDismissal]

Please help

Upvotes: 0

Views: 796

Answers (2)

user814037
user814037

Reputation:

Assuming you have an IBOutlet named username hooked up to the username UITextField, and an IBOutlet named password hooked up to the password UITextField, add the following code:

- (void)viewWillDisappear
{
    [username resignFirstResponder];
    [password resignFirstResponder];
}

this should then dismiss the keyboard when navigating to the next view

Upvotes: 0

Rahul
Rahul

Reputation: 961

use this.` [deposite resignFirstResponder].

Upvotes: 1

Related Questions