UITableView with UITextField - store data even after scrolling user

I have a UITableView and it has lots of UITableViewCells. These UITableViewCells have several UITextFields in it.

Now every time I scroll up and down - and the UITableViewCells exits the view - and returns to any text that I entered inside the UITextField, disappears - What is the best way to get this to work?

+4
source share
1 answer

create an NSMutableArray that at each position contains an NSString object that corresponds to each cell.

when you configure + to show each cell in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath , set the text UITextField to the string in the array at indexPath.row .

when editing a UITextField insert / update an NSString object at the current position of indexPath.row in the array

+11
source

Source: https://habr.com/ru/post/1333491/


All Articles