Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6113497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:51:57+00:00 2026-05-23T14:51:57+00:00

How can I hide the keyboard after the user presses ‘Done’, or taps the

  • 0

How can I hide the keyboard after the user presses ‘Done’, or taps the UITextField?

I have put this code in the AppDelegate:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return NO;
}

And I have linked the UITextField delegate in IB to the File’s Owner..

What am I doing wrong?

EDIT: Changin return NO -> return YES does nothing. I have IB open and clicking on file’s owner -> connections tab, there are multiple referencing outlets all pointing to the UITextfields. It still isn;t working..

UPDATE:

I added this to my function:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    int i = 5;
    NSLog(@"%d", i);
    return YES;
}

Nothing is getting printed to the console when I press return after setting focus to the textfield…So it’s not calling the function. Have I connected something up incorrectly? I have the return key acting as ‘Done’too, not sure if that makes a difference?

UPDATE:

I had my testfieldShouldReturn function in my AppDelegate instead of my viewcontroller. My mistake….Thanks for your help guys

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:51:58+00:00Added an answer on May 23, 2026 at 2:51 pm

    Your code looks good. Can you make sure that you do have the delegate connection set up correctly? Try adding an NSLog to the delegate method to see if it is even being called.

    …

    Your question update points to this definitely being a connection issue. Try what Vince suggests and set the delegate explicitly in code. You’ll probably want to do this in the viewDidLoad method of your view controller to ensure that the textField has actually been loaded before you set its delegate. Post back about whether that works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I code to ban system soft keyboard.It can achieve the effct,but it disappear after
I can hide the action bar in honeycomb using this code: getActionBar().hide(); But when
How can I hide a field in a SharePoint alert? I have a custom
I have a UISearchBar and on the delegate method I hide the keyboard when
I have UITextField which have keyboard type Numpad. I want to be able to
I have a problem with hiding keyboard in the iPhone simulator. My HTML code:
I have 6 UITextFields on my UIScrollView . Now, I can scroll by user
Is it possible to hide the iPad keyboard after entering a value into an
I have a modal view that with a UITextView, and the user can enter
I want to hide the keyboard after typing the content into the UITextView but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.