AQGridView icon indicating copy to clipboard operation
AQGridView copied to clipboard

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

Open ghost opened this issue 13 years ago • 2 comments

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

ghost avatar Apr 20 '12 15:04 ghost

Would you like to elaborate your use case so we can figure out a way around this or a fix?

On Apr 20, 2012, at 23:06, c4tto [email protected] wrote:

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


Reply to this email directly or view it on GitHub: https://github.com/AlanQuatermain/AQGridView/issues/127

evadne avatar Apr 20 '12 15:04 evadne

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.

ghost avatar Apr 20 '12 17:04 ghost