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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:09:33+00:00 2026-06-09T12:09:33+00:00

I am dumping multiple inputs into a view. They consist of UITextFields UIPickerViews and

  • 0

I am dumping multiple inputs into a view. They consist of UITextFields UIPickerViews and UIDatePickers.

Each of them have an ID and a Key that need to be saved when the input value is saved. So when the ‘Save’ button is clicked, I need to loop through and store something like:

{
   ID: 'inputid',
   Key: 'yearly',
   Value: (UITextField value)
}

In HTML, I would just add these values to the input (<input type="text" id="inputid" name="yearly" />) and then loop through each one using $(input).attr(‘id’) etc.

In Objective-C, the only way I can think to do this is to keep a hashtable of this information when I draw the inputs, and then store some kind of identifier against the ‘tag’ field of the UITextField, then read that by getting all of the inputs from a view and comparing them to the hashtable.

Is this the right way to go about it?? Am I missing something simple here? How would you go about it?

EDIT
To better frame the situation, the number of UITextFields on the page is being pulled from an XML file, therefore I don’t know how many UITextFields there will be (so can’t assign them to the controller necessarily)

I need something along the lines of:

foreach(var question in ArrayOfQuestions) {
    UITextField *textField = [[UITextField alloc] initWithFrame:];
    textField.attributes["id"] = question.Id;
    textField.attributes["key"] = question.Key;
}

and in the save method

foreach(var textField in UIView) {
    textField = (UITextField)textField;
    NSString *id = textField.attributes["id"];
    NSString *key = textField.attributes["key"];
}

This maybe something I could find in google but can’t think of the right search terms and keep coming up empty handed. On the same level, if you can better describe my request please update the title of my question

  • 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-09T12:09:34+00:00Added an answer on June 9, 2026 at 12:09 pm

    I think you are actually at the best solution, in regards to the hash table (NSDictionary) of attribute data. It is really a bad design decision to have too much semantic data in the view object itself, as it has nothing to do with the view.

    What you need to do concretely in code is the following:

    To set up your views & attribute data:

    UIView *containerView; // The view that contains your UITextViews.
    NSMutableDictionary *attributes; // A dictionary mapping tags to questions.
    NSMutableArray *arrayOfQuestions; // The questions that you've parsed from a file or whatever.
    
    // ...
    
    // Each "question" would be of the form @{ @"id" : ____, @"key" : ____ }
    for (NSDictionary *question in arrayOfQuestions) {
        UITextField *textField = [[[UITextField alloc] initWithFrame:aFrame] autorelease];
        [containerView addSubview:textField];
        textField.tag = getATag(); // However you want to tag them.
    
        // Fancy new objective-C container/object-literal syntax :)
        attributes[@(textField.tag)] = question;
    }
    

    Then for your “save” method:

    for (UIView *childView in containerView.subviews) {
        if ([childView isKindOfClass:[UITextView class]]) {
            // We know the class and can thus safely typecast the UIView.
            UITextField *textField = (UITextField *)childView;
    
            NSDictionary *aQuestion = attributes[@(textView.tag)];
    
            // Now you can access the id and key properties of the question.
    
            // ... Whatever else you want to do.
        }
    }
    

    The enumerated loop over the subviews is I think the big thing you were looking for here. It is very similar to the way that you would do it in jQuery with selectors.

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

Sidebar

Related Questions

I have a query that I'm dumping into a bar graph RDLC. I'd like
I have a project that requires us to maintain several MySQL databases on multiple
I am currently dumping all my logging into Log4Net text files, and they are
is there any pgp key dumping program like http://www.pgpdump.net/ that also shows the MPI
I was writing an asynchronous logging framework, where I had multiple threads dumping data.
What I have is 3 dictionaries dumping with pickle to 3 different files. I
I understand that there is a setting in Sun JVM for dumping the heap
I've currently got a project running on PiCloud that involves multiple iterations of an
We have a HPC node that runs some of our tasks in it. I
Short of SQL-dumping my entire database to text and searching that, is there a

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.