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

  • Home
  • SEARCH
  • 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 6544479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:28:12+00:00 2026-05-25T11:28:12+00:00

I created a form and the keypad (Numeric only) appears when entering data like

  • 0

I created a form and the keypad (Numeric only) appears when entering data like your age.

I want the keyboard to disappear when the user taps the background and I want to add a “Done” button in the empty slot under the 7 (next to the zero). (im using the Number Pad keyboard)

I found this example but I have a few questions.

In

-(void)viewDidLoad
{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self                                                                       action:@selector(dismissKeyboard)];  [self.view addGestureRecognizer:tap]; 
}

-(void)dismissKeyboard
{
[aTextField resignFirstResponder];
[aTextField1 resignFirstResponder];
[aTextField2 resignFirstResponder];
[aTextField3 resignFirstResponder];
}

If I have more than 1 text field in my form.
Will I need to write every textfield in the dismissKeyboard method?

  • 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-25T11:28:13+00:00Added an answer on May 25, 2026 at 11:28 am

    You should only send dismissKeyboard to that textField that you are currently editing.

    In your code you have got memory leak. Better use this one:

    -(void)viewDidLoad
    {
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboard)];
        [self.view addGestureRecognizer:tap]; 
        [tap release];
    }
    

    To check if UITextField is currently in edit mode you can check its property:

    A Boolean value indicating whether the text field is currently in edit mode. (read-only)

    @property(nonatomic, readonly, getter=isEditing) BOOL editing
    

    For example, you have 3 text fields then dismissKeyboard will look something like this:

    -(void)dismissKeyboard
    {
        UITextField *activeTextField = nil;
        if ([textField1 isEditing]) activeTextField = textField1;
        else if ([textField2 isEditing]) activeTextField = textField2;
        else if ([textField3 isEditing]) activeTextField = textField3;
        if (activeTextField) [activeTextField resignFirstResponder];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a form online and when the user clicks submit I want
Once I created a form builder where user could select any number of fields
I am trying to fill a livecycle created form with form data from django.
how to prevent security leaks in my own created form which data I write
I have created form with a submit button. I want when I click on
I have created a form that needs to show data from 2 tables (parent
I have created a form like this: class Form_Login extends Zend_Form { public function
I have created a form maker somewhat like Formtorch for codeigniter. The form consists
I have created Form and Grid Panel in Extjs now i want to display
I created a form for login, just like this: class LoginForm(AuthenticationForm): username = forms.CharField

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.