Oksana
Oksana

Reputation: 13952

Why text in hidden fields while I scrolling is clearing

I use UITableView. If I change text in text field and then scroll down this text field is clearing. Why text in hidden fields while I scrolling UITableView is clearing?

Upvotes: 0

Views: 116

Answers (1)

futureelite7
futureelite7

Reputation: 11502

That's because the table cells will get reused by cellAtRowInIndexPath as soon as it the user scrolls the cell off the screen. To preserve the content of the table cell you need to have the content stored into an NSArray in the table controller as soon as the user finishes editing text. If the user scroll back to your original row, read the text from the NSArray and set it back into the textField.

Upvotes: 1

Related Questions