You can clone with
HTTPS or Subversion.
I know it doesn't quite make sense in horizontal mode, but it would really be nice to have them in vertical mode.
Yep, i want this too. Shouldn't be that hard (as compared to section headers)
Just one header for the entire grid (with the benefit of scrolling with the grid content) or header per section ?
I also needed support for a grid header view. I added it to my fork:
It only seems to make sense for the Vertical Strategy. Looks weird for Horizontal strategies, specially the paged ones.
Right, you probably need to attach it to the grid view directly if you have paging enabled so it always stays on top.
How would you solve this? Add a BOOL to the layout strategy to indicate how the header/footer views are positioned (sticky or scrolling)?
I'm also very interested in the header view; we can add simple support for now and improve it with different layouts later.
Any opposition to that?
Sure no problem. I was thinking of a solution in the same direction as the layout strategy idea; as in giving the user control on how to position the header. So the core code doesn't has no logic about specifics headerView positioning behavior.
I like Markus's implementation of the headerview, that could be the headerViewContainer. And then the user can set any other view responding to a protocol with callbacks for when the scroll is scrolled for example, so the user can choose the reposition it's own headerView if needed.
The method to set the headerView could be setHeaderView:withSuggestedSize:
In the case of vertical layout, the headerView width will be that of the scroll frame and the height will be the above specified parameter. In the case of horizontal layout, the height will be that of the scroll frame and the width will be the above specified parameter.
What do you think? Is it overkill ?
I'm interested in the addition of this API, too.
I'm adding a header for the whole Grid in interface builder, and using setMinEdgeInsets: to shift the grid content down. This would work great except cells are dequeued & removed from the view prematurely when scrolling up (about 1 grid row distance). Thoughts? Am I using setMinEdgeInsets incorrectly?
Figured this out: When calculating out the rows to display, the vertical layout strategy doesn't take into account the minEdgeInsets. I changed line 225 in GMGridViewLayoutStrategies to:
CGFloat firstRow = MAX(0, (int)((contentOffset.y - self.edgeInsets.top) / itemHeight) - 1);
Any updates on this? Would really love to (easily) add a header view in vertical mode.
andrewtheis, fantastic catch on the layout strategy. aquarius branch + your fix made everything work :)
Did anyone ever implement this? I was hopping to included a searchbar at the top of the grdiview. So when you pull down it appears (like in mail).
I'm interested in this too.