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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:52:09+00:00 2026-05-15T21:52:09+00:00

I have a dependent UIPicker that loads the values into its two components from

  • 0

I have a dependent UIPicker that loads the values into its two components from a plist. It’s an NSDictionary with NSArrays of strings. The user selects a pair of components and the picker sends those two strings back to the delegate. What I really need is a constant that goes along with each individual choice. For example, first component is A, B, C and each choice has three subchoices A1, A2, A3, etc… User selects ChoiceA with ChoiceA3 and the picker returns the two strings fine, but I have a numeric constant that is associate with A-A3 and that is what I actually need for the math in my program.

Can I have two things associated with a particular key – a string AND a number? I guess what I want is a key-value-value pair (triplet)? It seems like using logic in my program to assign a value based on the key-value pair returned defeats the purpose of using a plist in the first place.

  • 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-05-15T21:52:09+00:00Added an answer on May 15, 2026 at 9:52 pm

    The ideal structure is actually to have a dictionary of dictionaries.

    A = {
      A1 = 36;
      A2 = 42;
      A3 = 89;
    };
    B = {
      B1 = 64;
      ...
    

    The plist is just a (collection of) serialization format. I don’t see how it’s defeated.


    To store key-value-value, you have 2 choices.

    (1) Create a new class.

    @interface StringNumberPair : NSObject {
      NSString* strval;
      int intval;
    }
    @property(copy) NSString* strval;
    @property(assign) int intval;
    -(id)initWithString:(NSString*)strval_ integer:(int)intval_;
    @end
    ...
    
    [theDict setObject:[[[StringNumberPair alloc] initWithString:@"string"
                                                         integer:42] autorelease]
                forKey:@"key"];
    
    • Pro — Clear interface.
    • Cons — You need to write a lot of code.

    (2) Make the value an array:

    [theDict setObject:[NSArray arrayWithObjects:
                                @"string", [NSNumber numberWithInt:42], nil]
                forKey:@"key"];
    

    or a dictionary:

    [theDict setObject:[NSDictionary dictionaryWithObjectsAndKeys:
                          @"string",                   @"strval",
                          [NSNumber numberWithInt:42], @"intval",
                          nil]
                forKey:@"key"];
    
    • Pro — These are standard types to store structured values. It is easily serializable to a plist.
    • Cons — Arrays and dictionary are too flexible.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 507k
  • Answers 507k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here is a WAG : Change it to say url:… May 16, 2026 at 4:08 pm
  • Editorial Team
    Editorial Team added an answer Use this: SELECT x.id, x.position, x.name FROM (SELECT t.id, t.name,… May 16, 2026 at 4:08 pm
  • Editorial Team
    Editorial Team added an answer You can implement tableView:viewForHeaderInSection: method in table's delegate and create… May 16, 2026 at 4:08 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a picker with three components. The first two components are dependent on
I have the UIPicker setup with multiple components and a button below it. Depending
It occurs to me that if you have fields dependent on each other in
I have a Variable that needs to be dependent on another variable inside a
I have class MyContainer < ActiveRecord::Base :has_many MyObjects, :dependent => :destroy end I want
I'm facing a situation where I have dependent objects and I would like to
I have a different subheader partial I want to render dependent on where I'm
I have a Maven project that consists of several modules. I have a single
I have some data from a unix commandline call 1 ab 45 1234 2
I have some jQuery code that runs fine until I add the jQuery UI

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.