Home > Software engineering >  Need Header on Top for Horizontal UICollectionView UIKIT
Need Header on Top for Horizontal UICollectionView UIKIT

Time:02-28

I am implementing custom headers for UICollectionView

I need a header on the Top for Horizontal CollectionView.

enter image description here

CodePudding user response:

In short, creating a custom UICollectionViewLayout is one way to get the results you want. This is quite a complex topic so the explanation is quite long.

Before adding some code, you will need to understand the different components in a UICollectionViewLayout such as cells, supplementary views and decoration views. Check UICollectionView Custom Layout

source: Custom UICollectionView layout swift iOS UICollectionViewLayout flow layout customization

If for some reason you weren't able to add the code to the right sections, have a look at this same example with the complete source code here

While I cannot cover everything, here are 3 great tutorials you can look at after going through this answer to understand more in depth:

  1. Ray Weldenrich: UICollectionView Custom Layout Tutorial
  2. Building a Custom UICollectionViewLayout from Scratch
  3. Custom Collection View Layouts
  • Related