UIGridView's scrollToCellAtCellPath method doesn't move the very first cell to the center of the UIGridView, I mean it doesn't scroll. But if the IGCellPath's columnIndex property is greater than 2 it works perfectly. Is it a bug or any solution and/or code sample?
-(void)didDeselectRowAtIndexPath:(UITapGestureRecognizer*)gesture {
// this method hits when the user taps on any carousel cell. let's say the cell.tag is 0 scroll doesn't work, but if it is greater than 2 it works; it scrolls the cell to the center of UIGridView.
CarouselCell* cell = (CarouselCell*)gesture.view; IGCellPath* toPath = [IGCellPath pathForRow:0 inSection:0 inColumn:cell.tag]; [_gridView scrollToCellAtCellPath:toPath atScrollPosition:IGGridViewScrollPositionMiddle animated:YES];
}
I changed the didDeselectRowAtIndexPath as:
-(void)didDeselectRowAtIndexPath:(UITapGestureRecognizer*)gesture{ CarouselCell* cell = (CarouselCell*)gesture.view; IGGridViewScrollPosition position; if (cell.tag < 2) { position = IGGridViewScrollPositionMiddleLeft; } else { position = IGGridViewScrollPositionMiddle; }
IGCellPath* toPath = [IGCellPath pathForRow:0 inSection:0 inColumn:cell.tag]; [_gridView scrollToCellAtCellPath:toPath atScrollPosition:position animated:YES];}
Now it scrolls all the cells from the beginning. Thanks.