[Solved] how to 100 text field in table view ios swift [closed]


create data module class as below

class Data {
   var text:String?
}

then add 100 objects in array and load tableview from array.
Now create custom cell & take reference of textfield in custom cell class. Implement observer for text change on textField in this class.

Now write function as below in custom cell

func configureCell(data:Data){

} 

call this function from cell for row at index path pass object at current index in this function.

Now declare local variable in custom cell which will hold reference of then object as below.

var data:Data?

func configureCell(data:Data){
self.data = data
 self.textField.text = data.text
}  

now in text did change method update text in data.text property

func textFieldDidChangeText(textField:UITextField){
    self.data.text =  textField.text
}

set textField text to data.text, so value will be retained even you scroll the application

0

solved how to 100 text field in table view ios swift [closed]