I’m trying to set up a UITableView which acts as a form. Each cell has within it a UILabel and a UITextField, so one cell is:
Name <enter name>
^ ^
UILabel UITextField
Now, I’m trying to populate the UILabel and the UITextField from a NSDictionary (from a plist), where it’s organized like so:
Root Type Value
Name String
Address String
City String
etc
But in order to get the right labels and textfields in the cellForRowAtIndexPath method, I would have to refer to the Dictionary numerically. Is there any way to do that?
No, since elements in an NSDictionary are not ordered.
You should really use an array as the model behind a table view data source. You can easily build one for your case:
Of course, for your case, a special order would be neccessary. So you would rather build your array using literals: