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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:48:38+00:00 2026-05-18T10:48:38+00:00

what i have is 3 textFields and whenever i touch textField1 or textField2 Picker

  • 0

what i have is 3 textFields and whenever i touch textField1 or textField2 Picker changes values and there is no keyboard. When i touch textField3 keyboard appears and the picker goes hidden.Now if i dismiss the keyboard by clicking return and then click textField1 picker appears again, but if i dont dismiss the keyboard BY CLICKING BUTTON it stays over the picker. What I need is when the keyboard is firstResponder (and i see it on the screen) to hide it if i click on the textField1 and only to see the picker

int variabla;

    -(void)textFieldDidBeginEditing:(UITextField *)textField{
        [pickerView setHidden:YES];
        if (textField1.editing == YES) {
            [textField1 resignFirstResponder];
            [pickerView setHidden:NO];
            variabla = 1;
        }else if (textField2.editing == YES) {  
            [textField2 resignFirstResponder];
            [pickerView setHidden:NO];
            variabla = 2;
        }   
        NSLog(@"variabla %d",variabla); 
        [pickerView reloadAllComponents];
    }

    - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;
    {
        return 1;
    }
    - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;
    {
        if (variabla == 1) {
            return [pickerArray1 count];
        }else if (variabla == 2) {
            return [pickerArray2 count];
        }else {
            return 0;
        }   
    }
    - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
    {   
        if (variabla == 1) {
            return [pickerArray1 objectAtIndex:row];        
        }else if (variabla == 2) {
            return [pickerArray2 objectAtIndex:row];
        }else {
            return 0;
        }   
    }
    - (void)textFieldShouldReturn:(UITextField *)textField{ 
        [textField resignFirstResponder];
    }
- (void)viewDidLoad {
    [super viewDidLoad];
    [pickerView setHidden:YES];
    pickerArray1 = [[NSMutableArray alloc] initWithObjects:@"0", @"1", @"2", nil];
    pickerArray2 = [[NSMutableArray alloc] initWithObjects:@"3", @"4", @"5", nil];
}
  • 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-18T10:48:39+00:00Added an answer on May 18, 2026 at 10:48 am

    ok for solve this problem you can use lot of option i tell you one of them.

    - (void)textFieldShouldBeginEditing:(UITextField *)textField {
    
      if([textField isEqual:yourTextField3])
      {
        yourPicker.hidden=YES;
      }
      else
      {
    
        [yourTextField3 resignFirstResponder];
        [self performSelector:@selector(textFieldFirstResponderOnDelay) withObject:nil afterDelay:0.3];
      }
    }
    
    
    - (void)textFieldFirstResponderOnDelay {
      yourPicker.hidden=NO;
    }
    

    And whatever you want you can put in to these conditions.

    or you can add tag with your textfield and check accordingly.Hide picker whenever you want or display picker and hide keyboard whenever you want.

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

Sidebar

Related Questions

i have been using an actionListener to pass text from numerous TextFields into a
I would like to dynamically modify the values of certain form elements, more specifically
I have a Windows Mobile Desktop Application that have some text fields which will
i have my form validated using jQuery and should be submited using ajax the
I have a form with text fields, text areas and checkboxes. At the moment,
I have a field for which rails_admin generates a textfield, but I'd like it
I have a UITextField in a custom tableview cell. On tapping the textfield area
Not sure why this isn't working. When people click the 'edit' button of my
I've created a UIViewController and xib for a login screen. It has now occurred
I'm having a problem to make unique attributes ! I am already searched here

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.