GMGridView icon indicating copy to clipboard operation
GMGridView copied to clipboard

Support grid header view and grid footer view

Open luosheng opened this issue 13 years ago • 15 comments

I know it doesn't quite make sense in horizontal mode, but it would really be nice to have them in vertical mode.

luosheng avatar Dec 22 '11 16:12 luosheng

Yep, i want this too. Shouldn't be that hard (as compared to section headers)

steipete avatar Dec 22 '11 17:12 steipete

Just one header for the entire grid (with the benefit of scrolling with the grid content) or header per section ?

gmoledina avatar Dec 22 '11 21:12 gmoledina

I also needed support for a grid header view. I added it to my fork: https://github.com/aquarius/GMGridView/commit/65d43a82657b01ece8f1fb651d16055b7a47f185

aquarius avatar Jan 05 '12 12:01 aquarius

It only seems to make sense for the Vertical Strategy. Looks weird for Horizontal strategies, specially the paged ones.

gmoledina avatar Jan 08 '12 04:01 gmoledina

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)?

aquarius avatar Jan 10 '12 08:01 aquarius

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?

steipete avatar Jan 12 '12 21:01 steipete

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 ?

gmoledina avatar Jan 13 '12 04:01 gmoledina

I'm interested in the addition of this API, too.

kielgillard avatar Feb 24 '12 00:02 kielgillard

+1 !

nomadplanet avatar Apr 19 '12 14:04 nomadplanet

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?

andrewtheis avatar Jun 14 '12 23:06 andrewtheis

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);

andrewtheis avatar Jun 18 '12 22:06 andrewtheis

+1

Any updates on this? Would really love to (easily) add a header view in vertical mode.

kylefox avatar Jun 26 '12 03:06 kylefox

andrewtheis, fantastic catch on the layout strategy. aquarius branch + your fix made everything work :)

m2d2 avatar Jul 06 '12 21:07 m2d2

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

bencallis avatar Jan 20 '13 02:01 bencallis

+1

I'm interested in this too.

neoneye avatar Jan 25 '13 15:01 neoneye