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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:27:08+00:00 2026-06-06T14:27:08+00:00

I just joined this site after looking very hard for an answer to my

  • 0

I just joined this site after looking very hard for an answer to my question and you guys seem to be amazing at what you do. I want to build a simple intro app for the iPhone. The problem I ran into is that I want to use a UIPickerView for choosing a variety of options, I have about 20 options in the pickerview. Next thing I want to do is to be able to open the next window when you click an option, I want to have individual windows for each of my options in the pickerview. Essentially I have a brand, then when you pick the brand by selecting it on the pickerview, you move on to the right accessories made for that brand. There are individual accessories made for each brand which is why I need a different new window for each. I already have my pickerview in place I just dont know how to proceed to the next step. Once I select an item on the pickerview by tapping, I want it to move to the corresponding next window. Thank you in advance for your help.

  • 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-06T14:27:09+00:00Added an answer on June 6, 2026 at 2:27 pm

    I’m going to assume that when declaring your UIPickerView, you’ve set the delegate to current view either in Interface Builder or done so in the code i.e. myPicker.delegate = self;. Also in your .h file, you have set up the controller such that it is analogous to myViewController: UIViewController<UIPickerViewDelegate>.

    You’ll implement the following method and use the row argument to decide which view to show next. This method gets fired after a row is selected (and was wired to do so the moment you specified which class is the delegate of the picker view). Assuming you’re using a navigationController, it could look something like:

    - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
        //For example, you can do a switch based on the row
        switch (row) {
             case 0:
                 [self.navigationController pushViewController:myFirstView animated:YES];
                 break;
             case 1:
                 [self.navigationController pushViewController:mySecondView  animated:YES];
                 break;
             // ..
             // ..
             case 19:
                 break;
             default:
            //...
        }
    }
    

    Note that if you declare a new variable (such as one of your view controllers) inside a case statement, you need braces { } inside the case statement in order to do so.

    Alternatively, if you don’t want the event to fire automatically after a row is selected (for example, in case of the user accidentally selecting a row), you can create a button that the user presses to confirm the selection/proceed. Upon pressing the button, the button’s target method could act according to the selected row in the picker. You can find the selected row with the following method call [myPicker selectedRowInComponent:0] (assuming your picker only has one column/”component”).

    Good luck!

    Edits (after reading your follow-up questions):

    Assuming that SingleComponentPickerViewController.h is the view where you created your UIPickerView.

    SingleComponentPickerViewController.h:

    @interface SingleComponentPickerViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource>
    

    SingleComponentPickerViewController.m:

    In your viewDidLoad, (or wherever you created the pickerview), set the delegate:

    -(void) viewDidLoad {
        //...
        myPickerView.delegate = self;
        //...
        [super viewDidLoad];
    }
    

    To access your myPickerView variable in the above method, it will mean that your UIPickerView object has class scope or is a property.

    Also, have the action that is fired after the button press in this file.

    -(void)onButtonPress:(id)sender {
        //This gets the currently selected row from the picker
        //Again, assuming you have your picker as a property or class variable
        int row = [myPickerView selectedRowInComponent:0];
    
        //In your final version you need to use a condition to decide which view to show.
        if (row == 0) {
            AnotherView *anotherViewInstance = [[AnotherView alloc] init];
    
            //Show "anotherView"
            [self.navigationController pushViewController:anotherViewInstance animated:YES];
        }
        else if (row == 1) {
            AnotherView2 *anotherView2 = [[AnotherView2 alloc] init];
    
            //Show "anotherView"
            [self.navigationController pushViewController:anotherView2 animated:YES];
        }
        else if (row == 2) {
            AnotherView3 *anotherView3 = [[AnotherView3 alloc] init];
    
            //Show "anotherView"
            [self.navigationController pushViewController:anotherView3 animated:YES];
        }
        //...continue with the rest of your conditions here
    }
    

    If you are using Interface Builder, then you should change the return type from void to IBAction.

    SingleComponentAppDelegate.m

    Right now I’m assuming your App Delegate’s didFinishLaunchingWithOptions looks something like this near the end:

    //....
    self.viewController = [[SingleComponentPickerViewController alloc] initWithNibName...];
    self.window.rootViewController = self.viewController;     
    [self.window makeKeyAndVisible];
    return YES;
    

    You want to modify it the window’s rootViewController property to be set to a navigation controller, with your custom view controller inside of it. This way, you can easily push and pop views onto the screen.

    //...
    //Create your base view, similar (or even identically) to what was done earlier
    SingleComponentPickerViewController *myView = [[SingleComponentPickerViewController alloc] initWithNibName...]; 
    
    //Stick it inside a UINavigationController so you can push and pop views on top of it.
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:myView];
    
    //Assign that to the window's rootViewController, show it, and return
    self.window.rootViewController = nav;     
    [self.window makeKeyAndVisible];
    return YES;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

just joined today loved this site already. My Question is that. i am trying
just joined this awesome site… Ive recently been working in XNA on C#, making
Folks, I have just joined this company which has a huge source tree based
i just joined this new group and basically haven't even really done any heavy
This is not a homework question, just something at work that's bugging me. I'm
I'm puzzled why I can't msgbox this joined array. I can do it just
Not far into programming and just joined this forum of mighty company so this
I just joined StackOverflow after having found many great answers here in the past.
I just joined this wonderful community, but it is with regret that I admit
Just learning the world of jquery, and all my googling gives examples like this:

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.