Question: “I should take textfield value from the cell. how can I do that?”
Answer: You shouldn’t do that.
View objects are for displaying information to the user and for collecting input, not for storing data.
This is especially important for UICollectionView
s and UITableView
s, since both of those create and recycle cells as needed as the user scrolls.
You should design your collection view to have a data model object (typically an array of structs, or an array of arrays for data in rows and columns).
As the user enters data into your text fields and taps return, you should collect the changed values and save them to your data model. Then your data model is always up-to-date and if you need to fetch the value for a specific IndexPath you just look up the data in the model.
0
solved Swift How can i take data from custom uicollectionviewcell?