ios – UICollectionView custom layout header view

0
54


Frank. I read your blog about custom UICollectionViewlayout, it’s awesome. I am encountering a problem with this topic for a few days.
On a single viewcontroller, there are two buttons at the navigation title view and a collection view at the view of this ViewController.
When clicking any button, the collectionView will reloadData and show the data from the server. There is a header view at the top of the collection view when clicking the first button, but for the second button, this header view should be not shown.
The issue is when I click the second button, there will be an empty white header view at the top, even if I set the size equal to zero and zIndex to 0.

Code: https://cmd.im/dnan