简体   繁体   中英

UITableViewCell text to equal an array

I am currently making code and I have saved an array full of textfields. The user will save the textfields to an array and then there will be a dictionary of arrays with all the different sets of textfield values. When they save the textfields to an array they will enter the name into another text field. How can I get the names of the array to load in a view controller so that when they click on a row the textfields associated with that array will load up? The table view, textfields, and textfield which names the array are all in separate views. I'm using interface builder if this helps.

NSArray *strings = @[self.normalWage.text, self.overtimeWage.text,
      self.mondayNormalTime.text, self.mondayOverTime.text, self.tuesdayNormalTime.text, 
      self.tuesdayOverTime.text, self.wednesdayNormalTime.text, 
      self.wednesdayOverTime.text, self.thursdayNormalTime.text, 
      self.thursdayOverTime.text, self.fridayNormalTime.text, self.fridayOverTime.text, 
      self.saturdayNormalTime.text, self.saturdayOverTime.text, 
      self.sundayNormalTime.text, self.sundayOverTime.text, self.bonusMoney.text];

NSDictionary *dictionary = @{ @"myNumbers" : strings };

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:strings forKey:@"myNumbers"];
[defaults synchronize];

You have a dictionary of arrays. I assume the dictionary keys are the array names. Display the names of the arrays in a table view (you can get them using the allKeys property of the dictionary. You can sort the array by name for better readability. Once the user selects a cell, pass the text fields view controller the array, and in viewDidLoad fill the data from the array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM