EmptyDataSet-Swift
EmptyDataSet-Swift copied to clipboard
Custom View For Collection View With Header
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.

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.
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.