Amr Mahmoud Amr Mahmoud - 2 months ago 11
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

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.

Comments