MHDev MHDev - 1 month ago 6
Swift Question

Is it possible to create a Custom UICollectionViewCell which looks like a table for data entry?

I am relatively new to iOS development in general, what I would like to know is:

Is it possible to create some form of cell like the image in the diagram:
Sketch Diagram

On the image there is an 'Add' button at the bottom, when the user clicks this I would like the cell to add another row. So initially it starts with just one row and then adds more from user preference.

Answer

You can achieve this by using UITableView. You can customize a UITableViewCell (each row with different data) to look like this:

enter image description here

I hope that you can imagine how the whole tableView should looks like.

ALSO: assuming that you check how to play with tableviews and knowing how you should confirm to UITableViewDelegate,

enter image description here

you could add the section above as a tableView(_:viewForHeaderInSection:).

enter image description here

and this one as a tableView(_:viewForFooterInSection:).

Hope this helped.