I have a dynamically generated UITableView (so I have to use prototype cells, not static cells) with many cells on it. Each cell will have a UILabel on it. Additionally, each cell will also have at least one UIControl (as of right now, it could be a UITextfield or a UISegmentedControl, but I want to keep it flexible in case I add something else in the future).
The user is going to go through and set all the controls to the state they want, then press a “Calculate” button at the end. On the click of that button, I’m going to need to be able to get information about what the user did with each control (what text the user has entered into each textfield, which segement they have selected in each control, etc.).
What would be the best way to set this up?
You should be getting these values from the model object that populates the table, not from the table itself. It’s hard to know how you should do this without knowing more about your data source, and what values you need when the user clicks a button — do you need values from all the rows? From just the row whose cell has the label cellLabel (if so, how do you know which cellLabel to pass to the method)?
How much it can be cleaned up depends to a great extent on the structure of your data.