Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom View For Collection View With Header #47

Open
ElrB opened this issue Oct 22, 2021 · 2 comments
Open

Custom View For Collection View With Header #47

ElrB opened this issue Oct 22, 2021 · 2 comments

Comments

@ElrB
Copy link

ElrB commented Oct 22, 2021

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
Copy link
Author

ElrB commented Oct 25, 2021

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.

@twomedia
Copy link

twomedia commented Dec 27, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants