The functioning of a Uitableview can be summarized as a list that only loads the required data (the ones being shown) while removing from memory cells that have already been loaded and disappear from the screen, as in your case where the value within the Uitextfield of a cell is lost when exiting the screen display.
The operation described by you is only achieved if you save the Uitextfield value and again assign the value when the cell is initialized in the cellForRow.
Something similar to this:
func cellForRow(at: IndexPath) -> UITableViewCell? {
...
cell.textField.tag = indexPath.row
cell.textField.delegate = self
cell.textField.text = self.arrayDeValores[indexPath.row]
...
return cell
}
As for the saving part of the inserted texts in the array you will need to implement Uitextfielddelegate for each one for then:
func textFieldDidEndEditing(_ textField: UITextField){
self.arrayDeValores[textField.tag] = textField.text ?? ""
}
Don’t forget to declare the array as a class scope variable. The property tag is used to identify the correct textfield.
Opa I could solve and I forgot to post here, but I believe that this solution and also work in my case I saved an array with the size of each cell to be able to set in heighForRowAt, apparently he put a smaller size for cell and it did not appear, But thanks for the young attention
– Vitor Mendes