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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:19:46+00:00 2026-06-15T16:19:46+00:00

I am setting up a UIPickerView to have choices like choice a , choice

  • 0

I am setting up a UIPickerView to have choices like choice a, choice b, choice c and so on. I have tried to interpret the sample code from Apple but that seems very difficult to understand for a beginner like me. I also would like the choices from the picker view to take me to another page if that is possible.

  • 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-15T16:19:46+00:00Added an answer on June 15, 2026 at 4:19 pm

    It’s obvious for every beginner that it is some what tedious to understand these things the first time.

    Anyways, do you know how to use UITableViews? Do you know how to use UITableViewDelegate and UITableViewDataSource? If your answer is yes, then just imagine UIPickerViews are like UITableViews (but remember they are not UITableViewControllers).

    Let’s say, I’ve a UIPickerView:

    UIPickerView *objPickerView = [UIPickerView new];  // You need to set frame or other properties and add to your view...you can either use XIB code...
    

    1) First you need to assign the delegate and dataSource to the UIPickerView either via IB or code. It depends on your implementation (So this step looks very similar to a UITableView, doesn’t it?)

    Like this:

    objPickerView.delegate = self; // Also, can be done from IB, if you're using
    objPickerView.dataSource = self;// Also, can be done from IB, if you're using
    

    2) Next, you need to define number of sections, like this:

    - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView {
         return 1;  // Or return whatever as you intend
    }
    

    2) Then you need to define the number of rows you need:

    - (NSInteger)pickerView:(UIPickerView *)thePickerView 
    numberOfRowsInComponent:(NSInteger)component {
         return 3;//Or, return as suitable for you...normally we use array for dynamic
    }
    

    3) Then, define title for row (And if you have multiple section, then title for each section):

    - (NSString *)pickerView:(UIPickerView *)thePickerView 
                 titleForRow:(NSInteger)row forComponent:(NSInteger)component {
         return [NSString stringWithFormat:@"Choice-%d",row];//Or, your suitable title; like Choice-a, etc.
    }
    

    4) Next, you need to get the event when someone clicks on an element (As you want to navigate to other controller/screen):

    - (void)pickerView:(UIPickerView *)thePickerView 
          didSelectRow:(NSInteger)row 
           inComponent:(NSInteger)component {
    
    //Here, like the table view you can get the each section of each row if you've multiple sections
         NSLog(@"Selected Color: %@. Index of selected color: %i", 
         [arrayColors objectAtIndex:row], row);
    
         //Now, if you want to navigate then;
         // Say, OtherViewController is the controller, where you want to navigate:
         OtherViewController *objOtherViewController = [OtherViewController new];
         [self.navigationController pushViewController:objOtherViewController animated:YES];
    
    }
    

    That’s all the implementation you need.

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

Sidebar

Related Questions

Setting up CI within Microsoft Team Foundation Server, I have a build that will
Setting: Java 5 - no upgrade possible. I have a large application that has
Setting arbitrary attributes from outside works for normal classes, but not for internal objects
setting is the following: I have a homepage where I display a diagram that
Is it possible to load an uipickerview with values but by default have no
I have a UIPickerView that is populated by an NSMutableArray called sectionNamesArray. When an
Setting: I have (simple) .csv and .dat files created from laboratory devices and other
Setting <compilation debug=true/false> in Web.config seems to do things that you can also set
Setting variables as returned lists from functions that contain variables as a returned list
Setting up a project structure; I am thinking is it better to have somewhat

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.