EmptyDataSet-Swift icon indicating copy to clipboard operation
EmptyDataSet-Swift copied to clipboard

Custom View For Collection View With Header

Open ElrB opened this issue 4 years ago • 2 comments

Hi, I would like your help on how I can go about creating a custom view for a collection view that has a header. I need a to create a custom view otherwise the default empty data set view would cover the header as well, and users won't be able to interact with the elements on the header (if there is a way to make the default empty data set view not to cover the header that would be great). Else, how could I get the y coordinate for custom view so it starts where header ends (y coordinate in CGRect method initialization). Thanks a lot.

Below is a screenshot of the collection view.

Screen Shot 2021-10-19 at 9 45 21 AM

ElrB avatar Oct 22 '21 23:10 ElrB

Managed to make a custom view that is only covering the cells part, but my header elements are still not interactive, they do not respond to touches. Need help.

ElrB avatar Oct 25 '21 05:10 ElrB

I was facing the same issue, implementing the following delegate and passing false fixed it for me:

func emptyDataSetShouldAllowTouch(_ scrollView: UIScrollView) -> Bool {
        return false;
}

I know in your case you have a button in the empty dataset view, so this might not be the ideal solution. When I debugged I noticed that the empty data set UI covers the entire collectionView so that's why nothing in the header is clickable if user interaction is enabled.

twomedia avatar Dec 27 '21 19:12 twomedia