Amr Mahmoud Amr Mahmoud - 10 months ago 66
Swift Question

Create a custom scrollable collection view that mimics the behaviour of UITableView in Swift

I have this task that I need to create a custom scrollable view with 3 different types of cells from scratch.(no UICollectionView nor UITableView)

I have no idea what is the best way to start. Wether I should subclass UIScrollview or ...

Any guidance or direction would be highly appreciated.

Answer Source

Create object of UIView, keep adding in UIScrollView depends on your array count.

Keep dynamic calculation for next UIView add subview in UIScrollView

Put transparent UIButton on UIView or use touch gesture to implement like didSelectedRowAtindex.

Another solution we can adapt when there is no UITableView.