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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:24:51+00:00 2026-06-14T23:24:51+00:00

int variabla; – (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 1; } – (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {

  • 0
int variabla;

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {

return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {


if (variabla == 1)
    return list4.count;

else if(variabla == 2)
    return list3.count;

if (variabla == 3)
    return list1.count;

if (variabla == 4)
    return list2.count;

return YES;

[pickerView reloadAllComponents];
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
if (variabla == 1) {
    subjectField.text = [list4 objectAtIndex:row];
}
else if  (variabla == 2) {
    gradeField.text = [list3 objectAtIndex:row];
}
else if (variabla == 3) {
    mathField.text = [list1 objectAtIndex:[pickerView selectedRowInComponent:0]];
    selectedRow = [pickerView selectedRowInComponent:0];
    coreTView.text = [mathMeaning objectAtIndex:selectedRow];
}
if (variabla == 4) {
    elaField.text = [list2 objectAtIndex:[pickerView selectedRowInComponent:0]];
    selectedRow = [pickerView selectedRowInComponent:0];
    coreTView.text = [elaMeaning objectAtIndex:selectedRow];
}


[pickerView reloadAllComponents];
NSLog(@"row selected is %d", selectedRow);

}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component  {

if (variabla == 1)
    return [list4 objectAtIndex:row];


if (variabla == 2)
    return [list3 objectAtIndex:row];

if (variabla == 3)
    return [list1 objectAtIndex:row];

if (variabla == 4)
    return [list2 objectAtIndex:row];

return NO;

[pickerView reloadAllComponents];
}

I would like to know or pointed in the right direction on how to load a UIPickerView based on the user input from a previous UITextField so if they type in the previous textfield apple, I would like red, green, blue to show in the UIPickerView or if they type orange, I would like to see orange, yellow.

  • 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-14T23:24:53+00:00Added an answer on June 14, 2026 at 11:24 pm

    Sounds like a good time to use a multidimensional array:

    NSArray *titles = [[NSArray alloc] initWithObjects:
     [[NSArray alloc] initWithObjects:@"Red",@"Green",@"Blue",nil],
     [[NSArray alloc] initWithObjects:@"Orange",@"Yellow",@"Grape",nil],
     nil];
    

    Now all you need is an int (looks like you’re using variabla) that represents the input- for example, if the user entered “Apple”, then you’d set variabla to 0; if they entered “Orange”, set variabla to 1; and so on.

    Then, you could set up the relevant functions accordingly:

    - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
        return [[titles objectAtIndex:variabla] count];
    }
    
    - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component  {
        return [[titles objectAtIndex:variabla] objectAtIndex:row];
    }
    

    You may add support for as many words as you want by simply adding another NSArray to titles.

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

Sidebar

Related Questions

class a { int variable;//4 bytes } class a { static int variable;//? bytes
I have an unsigned int variable and it can only have the values of
I have a int variable witch holds the old battery value it is declared
Let's say I have a C# variable and array: int variable_1 = 1; int[3]
Possible Duplicate: ++ operator in Scala I want to increment an Int variable in
I have the next scenario: I define an int[][] variable in my main class.
I want to print the content of an int variable on a status toolbar
in SQL Server, if I have an int variable, how can I write a
In a multi-threaded environment like Android, where a simple int variable may be manipulated
Suppose that I have those three files: a.h //a.h header #include <stdio.h> int int_variable;

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.