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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:37:47+00:00 2026-06-13T19:37:47+00:00

I am very new o XCode. I was using Picker VIew and got stuck

  • 0

I am very new o XCode. I was using Picker VIew and got stuck at one place.
I have a Picker View with two Components. And I have three arrays. Array, Array1, Array2.

Now what I want to accomplish is that. When the first object of Array is selected in Component 0, second component gets populated by Array 1.
And when second object is selected from Array in first component. Second Component gets reloaded and gets populated by Array2.

I am very confused on how to accomplish this.

- (NSInteger)numberOfComponentsInPickerView:
(UIPickerView *)pickerView
{
return 2;
}

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

- (NSString *)pickerView:(UIPickerView *)pickerView
         titleForRow:(NSInteger)row
        forComponent:(NSInteger)component
{
if (component == 0)
return [Array objectAtIndex:row];
else 
    return [[ArraysOFArrays objectAtIndex:row]objectAtIndex:0 ]; 
 //ArraysOFArrays = Array1 & Array2
[technologyPicker reloadComponent:1];
}

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row
  inComponent:(NSInteger)component
{   
    if ((component == 0) && (row ==0))
    { 
    if (component == 1)
    {
        [Array1 objectAtIndex:0];

    }
    selectTechnology.text = [technologyData objectAtIndex:row];
   [technologyPicker reloadComponent:1]; 
}

if ((component == 0) && (row ==1))
{ 
    if (component == 1)
    {
    [Array2 objectAtIndex:0];

    }

    [technologyPicker reloadComponent:1]; 
}


}
  • 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-13T19:37:48+00:00Added an answer on June 13, 2026 at 7:37 pm

    I have modified your code try this. Take a global variable “selected” of type int and initialize its value to 0 . And BTW what is this “technologyData”?

    No of components

    - (NSInteger)numberOfComponentsInPickerView:
    (UIPickerView *)pickerView
    {
    return 2;
    }
    

    No of Rows in component

    - (NSInteger)pickerView:(UIPickerView *)pickerView
    numberOfRowsInComponent:(NSInteger)component
      {
         if (component==0)
             return [Array count];
         else
         {
              if(selected==0)
                  [[ArraysOFArrays objectAtIndex:0]count];
              else
                  [[ArraysOFArrays objectAtIndex:1]count];   
         }
    }
    

    title for row

    - (NSString *)pickerView:(UIPickerView *)pickerView
             titleForRow:(NSInteger)row
            forComponent:(NSInteger)component
    {
    if (component == 0)
        return [Array objectAtIndex:row];
    else 
        return [[ArraysOFArrays objectAtIndex:selected]objectAtIndex:row]; 
     //ArraysOFArrays = Array1 & Array2
    }
    

    did Select row in a component

    -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row
      inComponent:(NSInteger)component
    {   
        if (component == 0)
        { 
            if (row == 0)
            {
                selected=0;
                [technologyPicker reloadComponent:1];
            }
            else
            {
                 selected=1;
                [technologyPicker reloadComponent:1];
            }
         }
         else
            **selectTechnology.text = [[ArraysOFArrays objectAtIndex:selected]objectAtIndex:row];**
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi there I am new to C programming and have been using Xcode to
I am very new to xcode & Objective-C (having come from PHP) i have
I have a very simple game using Xcode v4.2.1, Cocos2d v5.0.1. I've tried both
Im very new to xcode and i have a question to my first app.
I am a .Net developer and very new to Xcode. I am using WCF
I'm using Xcode 4.3.3 and Storyboards for this project. I have a master view
I'm very new to iPhone development. I drew a View using the Interface Builder
I'm somewhat new to XCode and am very accustomed to using Visual Assist with
So I am very new to xcode and iOS and just getting use to
I am very new to the Xcode environment. I would like to compile some

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.