Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

didSelectItemAtIndex:(NSUInteger)index not working properly #210

Open
Joshua4550 opened this issue Jun 25, 2014 · 1 comment
Open

didSelectItemAtIndex:(NSUInteger)index not working properly #210

Joshua4550 opened this issue Jun 25, 2014 · 1 comment

Comments

@Joshua4550
Copy link

I have a basic gridview setup with a basic custom cell (one image, one label). The didSelect method works fine until I introduce a variable Cell Identifier.

One cell identifier will use a frame of 50% width, and the second identifier will use a width of 100%. The 50% Identifier is used in all cases, except for when the datasource count is odd and it is currently the last grid item (ie, two columns until the last item then one column).

The cells are rendered perfectly fine, but when it comes to clicking.. all the 50% ones work, and the 100% width item does not even recognise it is being clicked - nothing!

Test Code... (cellForItemAtIndex)

static NSString *CellIdentifier = @"HalfGridCellIdentifier";
static NSString *CellIdentifier2 = @"FullGridCellIdentifier";
ThumbnailGridCell *cell;

/**
 * Odd number of rows, so the last row should always be full width
 */
if (datasource.count > 0 && datasource.count % 2 && index == datasource.count - 1) {
    cell = [[ThumbnailGridCell alloc] initWithFrame: CGRectMake(0, 0, aGridView.frame.size.width, gridSize.height) reuseIdentifier: CellIdentifier2];
}
/**
 * Even number of rows or not last row, so half width
 */
else {
    cell = (ThumbnailGridCell *)[aGridView dequeueReusableCellWithIdentifier: CellIdentifier];
    if (cell == nil) {
        cell = [[ThumbnailGridCell alloc] initWithFrame: CGRectMake(0, 0, gridSize.width, gridSize.height) reuseIdentifier: CellIdentifier];
    }
}

Test Code (didSelectItemAtIndex):

NSLog(@"clicked item %d", index);
@CMathgician
Copy link

Someone, Please fix it.. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants