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 7403843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:10:06+00:00 2026-05-29T05:10:06+00:00

my objective simply to save text on UITextField after user click done button on

  • 0

my objective simply to save text on UITextField after user click done button on keyboard. I could either do this in extFieldShouldReturn or textFieldDidEndEditing: does it make any difference ? or there a better approach ?

Thanks!!

  • 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-29T05:10:07+00:00Added an answer on May 29, 2026 at 5:10 am

    textFieldShouldReturn is only called if the user presses the return key. If the keyboard is dismissed due to some other reason such as the user selecting another field, or switching views to another screen, it won’t be but textFieldDidEndEditing will be.

    The best approach is to use textFieldShouldReturn to resign the responder (hide the keyboard) like this:

    - (BOOL)textFieldShouldReturn:(UITextField *)textField
    {
        //hide the keyboard
        [textField resignFirstResponder];
    
        //return NO or YES, it doesn't matter
        return YES;
    }
    

    When the keyboard closes, textFieldDidEndEditing will be called. You can then use textFieldDidEndEditing to do something with the text:

    - (BOOL)textFieldDidEndEditing:(UITextField *)textField
    {
        //do something with the text
    }
    

    But if you actually want to perform the action only when the user explicitly presses the “go” or “send” or “search” (or whatever) button on the keyboard, then you should put that handler in the textFieldShouldReturn method instead, like this:

    - (BOOL)textFieldShouldReturn:(UITextField *)textField
    {
        //hide the keyboard
        [textField resignFirstResponder];
    
        //submit my form
        [self submitFormActionOrWhatever];
    
        //return NO or YES, it doesn't matter
        return YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My objective with this code is when an user click in edit button, is
I'm new with Objective-C, so there probably is a simple solution to this. I
I have a class called CookieMonster, its objective is to simply create a cookie
I would like to add some automated performance test to my Objective-C application. (This
I have done a lot of research on this and haven't found anything useful.
My objective is to simply to change a function call from one to another,
After four weeks of learning Objective-C for the iPhone, my first useful application is
When synthesizing properties in Objective-C, it's recommended that you dont simply write: @synthesize window;
I have this regular expression in objective-c NSString* searchString = [searchBlock stringByReplacingOccurrencesOfString:@<(.*?)> withString:@ options:
After Python Objective-C syntax blows my mind! I'm trying to create a menu that

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.