Pedro Paulo Pedro Paulo -4 years ago 111
Swift Question

Information from a PickerView appears in another line of the TableView. How to solve?

Hello programmers friends. I have a situation I can not explain. I'll leave the prints on the screens and then describe what happened.




Initially I select the quantity in the pickerview and it changes in the UITextField field. Then when I scroll the screen, the 6 row of the table is with the PickerView information from row 1, and then when I roll the screen up, the data is lost. Has anyone ever had a similar problem?

Answer Source

When a quantity is selected, you need to persist that information in your data model. UITableView only creates enough rows to show what's visible on screen and it re-creates rows as they are scrolled into view. So you need to have the quantity information stored elsewhere to provide to the table view when it asks again for the row information. Hope this makes sense?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download