How to add HeaderView in UICollectionView like UITableView's tableHeaderView
ios, objective-c, swift, uicollectionview, uitableview
Solution
I've put a view at the top of a collection view by just adding a UIView as a subview of the collection view. It does scroll up with the collection view and it has normal UIView user interaction. This works ok if you have no section header, but doesn't work if you do. In that situation, I don't see anything wrong with the way you're doing it. I'm not sure why you're not detecting touches, they work fine for me.
Problem
How can I add a header view / top view (not section header) at the top of a `UICollectionView`? It should act excactly as `UITableView`'s `tableHeaderView` property. So it needs to sit on top of the first section header view (before the section at index 0), scroll along with the rest of the content, and have user interaction. The best I've come up with so far is to make a special XIB (with `MyCollectionReusableView` subclass of `UICollectionReusableView` as the File's owner) for the first section header view that is big enough to also contain my subviews in header, it's kind of a hack, I think, and I haven't managed to detect touches. Not sure if I can make my `MyCollectionReusableView` subclass to allow touches or there's a better way.