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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:39:57+00:00 2026-05-24T23:39:57+00:00

Hi I am developing an iphone app where I have populated a uipickerview and

  • 0

Hi I am developing an iphone app where I have populated a uipickerview and it works great with one uitextfield. But I have 6 uitextfield I need to populate and I am using the same uipickerview for each UItextfield.

I have working the Ipickerview loaded with array objects and it pops up when each field is touched. The problem is with the code below the UItextfields share the same data from the picker.

I can not figure out how to code so each field gets it own data from the UIPickerView row.
What Am I doing wrong? Any coding suggestions?

Thanks

@implementation BestViewController

-(NSInteger)numberOfComponentsInPickerView: (UIPickerView *)thePickerView 
{ return 1; }

-(NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:                    (NSInteger)component 
{return [list count]; }

-(NSString *)pickerView:(UIPickerView *)thePickerview titleForRow:(NSInteger)row  forComponent:(NSInteger)component 
{return [list objectAtIndex:row]; }

-(void)pickerView:(UIPickerView *)thePickerview didSelectRow:(NSInteger)row inComponent:      (NSInteger)component 
{ 
    uitextfield1.text = [list objectAtIndex:row];   
    utitextfield2.text = [list objectAtIndex:row];
}



- (void)viewDidLoad {

[super viewDidLoad];

    uitextfield1.inputView = pickerView; 
uitextfield2.inputView = pickerView;

list = [[NSMutableArray alloc] init];   
[list addObject:@"a"];
[list addObject:@"b"];
    [list addObject:@"c"];  
    [list addObject:@"d"];
}    
  • 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-24T23:39:58+00:00Added an answer on May 24, 2026 at 11:39 pm

    You need to get hold of the current first responder and set its text property rather than explicitly setting a particular text field.

    So,

    -(void)pickerView:(UIPickerView *)thePickerview didSelectRow:(NSInteger)row inComponent:      (NSInteger)component 
    { 
        // textFields is an NSArray holding each of the textfields that are using the picker as an input view
        for (UITextField textField in textFields)
        {
            if ([textField isFirstResponder])
            {
                textField.text = [list objectAtIndex:row];
                break;
            }
        }    
    }
    

    There may be a more elegant way to find the current first responder, this is off the top of my head. textFields could possibly be an IBOutletCollection, but I haven’t used those myself so I can’t speak with much authority.

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

Sidebar

Related Questions

I'm currently developing an iPhone app where I have two UITextField's in one View
I am developing native iPhone app. I have one requirement that, there are 5
I am developing a iPhone app using Monotouch. I need to access a Sqlite
I'm developing an iPhone app where I need to have some images. Particulary I
im developing an iphone app using yahoo weather service ( i have a key
I'm developing an iPhone app and have a question about memory management. Let's say
I have iPod touch 4th. And I'm developing iPhone app with it. I use
I have finished developing a big and heavy app. It is universal (for iPhone
*Hey , I have finished developing my app In my iphone apps I have
I'm developing an iPhone app and have a cell object. UITableViewCell *cell = [myTableView

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.