Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Delegate method for when cells will be displated #40

Open
kylefox opened this Issue · 2 comments

2 participants

@kylefox

It would be really nice to have something that tells the when a cell is about to be drawn on the screen. Methods such as:

willDisplayCell:atIndex:
didDisplayCell:atIndex:

(Similar to tableView:willDisplayCell:forRowAtIndexPath: in UITableViewDelegate's)

Here's an example use case:

I am using GMGridView to display full-screen photos in a single row. The view controller allows captions (a UILabel on each cell's view) to be toggled on/off. I need a way to either show or hide this label just before the cell comes into view to ensure that the state is correct.

Using cellForItemAtIndex doesn't work, because the current, previous and next cells are all pre-loaded, so their state is incorrect. I've also tried calling [gridView reloadData] to force invalidate all the cells, but that causes the images to flicker.

Any suggestions?

@gmoledina
Owner

Yup will definitely try to add these methods !
I'll be using the gridview in the exact same context as you so I'll be needing these methods too.

In the meantime, you can set yourself as the scroll delegate of the grid (the grid inherits from UIScrollView - in develop branch) and when you get the callback that the scrollview has stopped scrolling, you could check which cell is displayed based on their frame and the scroll's contentOffset (yes this is a very temporary solution).

@kylefox

Ok thanks, I will move to the development branch and try your suggestion for now.

Unrelated: do you have any idea when you'll be merging the develop branch into master? It seems like there have been some API changes, and I'm wondering if I'm better off building my app against "develop" going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.