Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Delegate method willSelectItemAtIndex can't skip item selection + additional issues #127

Open
c4tto opened this Issue · 2 comments

2 participants

@c4tto

There is no way to skip cell selection (and also deselection of previously selected cell).

1) The message [delegate willSelectItemAtIndex:] is called after cell deselection and no return value can't skip calling [delegate didSelectItemAtIndex:]

2) It isn't possible to use gridView.indexOfSelectedItem in [delegate willSelectItemAtIndex:], value is NSNotFound in every cases (it causes premature deselection).

3) Delegate methods willSelect+didSelect are called even if user tapped to grid view but out of any cell (index value is NSNotFound in this case).

@evadne
Collaborator
@c4tto

I suppose that the behavior of AQGridView should be very similar to UITableView.

1) There is possibility in UITableView to skip selection in delegate method willSelectRowAtIndexPath. Usual return value is new indexPath in this method, but you can refuse selection change by returning nil. I thought I can also refuse selection in AQGridView by using value NSNotFound, but it doesn't work.

2) I want to check before cell selection if some other cell is already selected. Unlike UITableView I can't do it, because deselection is performed too early. The value of gridView.indexOfSelectedItem is always NSNotFound willSelectRowAtIndexPath.

3) I have a grid view which isn't full and there is some free space under cells. If user tap to that space, both methods willSelect+didSelect are called and index value is NSNotFound. I think that methods shouldn't be called.

@c4tto c4tto referenced this issue from a commit in c4tto/AQGridView
@c4tto c4tto Issue #127 - The behavior of [delegate willSelectItemAtIndex:] is mor…
…e similar to UITableView.

1) selection change can be refused in method by returning value NSNotFound.
2) deselection of previous selected item is made after calling willSelectItemAtIndex method, so it is possible to use gridView.indexOfSelectedItem
3) Grid view which isn't full and there is some free space under cells. If user tap to that space, both methods willSelect+didSelect are called and index value is NSNotFound. Fixed, methods aren't no more called.
2a39209
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.