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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:07:03+00:00 2026-06-03T00:07:03+00:00

I have an IBAction that is called when someone is done entering text in

  • 0

I have an IBAction that is called when someone is done entering text in a field. I then validate the input. If I have determined there is an error, I display a message and want the user to enter into that same field again. Rather than make them select the text field to bring the keyboard up (which works fine) I want to just leave the keyboard displayed.

I am doing [SymbolEntered becomeFirstResponder]; as the last statement in my IBAction, but the keyboard still goes away. Am I putting that in the wrong place? Any help would be appreciated. Thanks.

- (IBAction)textFieldDoneEditing:(id)sender {

    DebugMsg.text = nil;
    DebugMsg2.text = nil;
    DebugMsg3.text = nil;

    NSLog (@"done editing");
    NSLog (@"%@", SymbolEntered.text);

    if ([SymbolEntered.text isEqualToString:nil])
    {
        Result.textColor = [UIColor redColor];
        Result.text = @"You must enter a symbol!";
        [SymbolEntered becomeFirstResponder];
    }
    else 
    {
        if ([SymbolEntered.text isEqualToString: 
             [NSString stringWithCString:elements_table2[el_tbl_idx-1].element_symbol]])
        {
            correct_count++;
            Result.textColor = [UIColor greenColor];
            Result.text = @"Correct!";
            Score.hidden = FALSE;
            Score.text = [NSString stringWithFormat:@"Score: %d out of %d - %d Percent", correct_count, el_count+1,
                                        (correct_count*100)/(el_count+1)];
            GetNextElementButton.hidden = FALSE;
            SymbolEntered.enabled = FALSE;
            el_count++;
            attempts = max_tries + 1;
        } 
        else 
        {
            Score.hidden = TRUE;
            Result.textColor = [UIColor redColor];
            if (attempts < max_tries)
            {
                if (attempts+1 == max_tries)
                {
                    Result.text = @"Sorry, one more try -";
                }
                else
                {    
                    Result.text = @"Sorry, try again - ";
                }
                GetNextElementButton.hidden = TRUE;
                attempts++;
            }
            else
            {    
                Result.text = [[NSString alloc] initWithFormat: @"Sorry.  The correct answer is %@", 
                   [NSString stringWithCString:elements_table2[el_tbl_idx-1].element_symbol]];
                Score.hidden = FALSE;
                Score.text = [NSString stringWithFormat:@"Score: %d out of %d - %d Percent", correct_count, el_count+1,                      (correct_count*100)/(el_count+1)];
                GetNextElementButton.hidden = FALSE;
                SymbolEntered.enabled = FALSE;
                el_count++;
            }
        }
    }   

    [SymbolEntered becomeFirstResponder];        

    NSLog (@"end of textfieldoneediting");
}  
  • 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-06-03T00:07:05+00:00Added an answer on June 3, 2026 at 12:07 am

    You can do your validation in the UITextField textFieldShouldEndEditing: delegate method instead. If you return NO from that callback, the text field will remain first responder and the keyboard won’t go away. (You’ll have to make your controller object the text field’s delegate if it isn’t already, of course.)

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

Sidebar

Related Questions

I have some code as shown below: - (IBAction)startButtonPressed:(id)sender { statusText.text = @Processing...; //here
I have a UITextview delegate - (BOOL)textView:(UITextView *)textView that is never getting called and
I have a UITableViewController (called Details). In that tableView on row 1 I have
Here's my code (it's wrapped in an IBAction that is called when the button
So I have a UIViewController subclass called MyTabBarViewController that has a UIScrollView. Inside of
I have a core data model with an entity called clients that is made
I have a UIProgressView called progTimer that I placed on my View Controller via
Hello I have a problem with UITableView freeze, downloadItem below gets called when someone
Im trying to call an IBAction Method in two classes that is called whenever
I have a UIView that contains a subview called menuView managed by a MenuViewController.

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.