You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
The text was updated successfully, but these errors were encountered:
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)
Test Code (didSelectItemAtIndex):
The text was updated successfully, but these errors were encountered: