arvidurs
arvidurs

Reputation: 3033

Validate n-amount of UITextfields inside UITableView

I am running into a "slight" problem using dynamic cells and UITextfield validations.

Due to the fact that the rows get reused the cells dont actually exists in the table view.

Lets say I have 20 rows, each as a UITextfield but only 5 are visible at a time, how would I validate all the fields to check if the text entered is correct?

Please help a fellow out

Upvotes: 0

Views: 151

Answers (1)

dr_barto
dr_barto

Reputation: 6065

You should store the entered data separately in a model object; in your case, a simple array of strings might be sufficient. Whenever a user enters (or changes) a text, set (or update) the respecive array entry; for validation you can then just use your array and ignore the texts in the UI.

Upvotes: 1

Related Questions