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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:26:25+00:00 2026-06-09T09:26:25+00:00

I am developing an App for iPhone (my first app) and I want to

  • 0

I am developing an App for iPhone (my first app) and I want to use two UIPickerView’s to display some data. The first UIPickerView is going to display a list of car brands (e.g. BMW, Mercedes, Ford etc…) And the second UIPickerView is going to display models, depending on which UIPickerViewItem you select in the first UIPickerView.

The problem I have is not setting up the UIPickerView’s, that’s already been done.

I want to know how I can populate both PickerViews from some sort of data storage (maybe sqlite, core-data…? Not sure how neither works though) and also, the second PickerView should only be populated once the first one has selected an item, so it only shows the models for that brand.

I hope you understand, as I am really not getting how to do this (I usually only do web-developing and this is extremely easy using PHP & MySQL…) 😉

Thank’s in advance!
Mike

  • 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-09T09:26:27+00:00Added an answer on June 9, 2026 at 9:26 am

    Core data is the way to go, but the learning curve is steep. You should put quite some time aside to learn it.

    Much easier and perhaps sufficient for your purposes is to work with plists. These are Apple specific xml files and very simply structured. You can edit them right in Xcode and the format is very transparent.

    You could then load all the data at once from the plist and populate the second picker depending on the choice in the first.

    Alternatively you could use JSON files. These are even simpler, and as a web programmer, you are probably familiar with those.

    Some hints:

    Your data should have this structure: array of dictionaries; each dictionary has a key for the brand and one for another array, a list of models. This subarray is a dictionary with a key for the name (and perhaps more if you need it in your app).

    You can load the plist file called “Data.plist” like this (JSON is analog):

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Data" ofType:@"plist"];
    NSArray *data = [NSArray arrayWithContentsOfFile:path];
    

    Now you can get a list of brands like this (assuming your brand name key is “name”):

    NSArray *brands = [data valueForKeyPath:@"name"]; 
    

    And a list of makes for a brand:

    NSArray *models = [[[data filteredArrayUsingPredicate:[NSPredicate
       predicateWithFormat:@"name = %@", @"Ford"]] objectAtIndex:0] 
        valueForKey:@"models"]);
    

    To react to a selection of the first picker view, make sure your view controller is the delegate of the picker views and override pickerView:didSelectRow:inComponent:.

    You can distinguish your pickers in these delegate methods by assigning tags and checking for them in the callback methods.

    Here is an example of your plist strucure:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <array>
        <dict>
            <key>name</key>
            <string>Ford</string>
            <key>models</key>
            <array>
                <string>Mustang</string>
                <string>Capri</string>
            </array>
        </dict>
        <dict>
            <key>name</key>
            <string>VW</string>
            <key>models</key>
            <array>
                <string>Polo</string>
                <string>Golf</string>
            </array>
        </dict>
    </array>
    </plist>
    

    Hope this helps.

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

Sidebar

Related Questions

I'm developing my first iPhone app. One day, I renamed some files including xib
I'm developing a first iPhone app for iOS 4.x/5.0 and have some confusions on
I'm developing an iphone app that makes use of of a UIWebView to display
I'm developing my first iPhone app, which is a navigation based one. I want
I've been developing my first iPhone app part-time and would like to start using
I have iPod touch 4th. And I'm developing iPhone app with it. I use
I'm developing my first iPhone app and I would greatly appreciate you guy's input
I'm developing an iPhone app. In a label, I want to show an user's
I'm developing an iPhone app where I use a NSFetchedResultsController in the main table
I'm running into a crash issue while developing an iPhone app with Core Data.

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.