scrollToObjectAtIndex:atScrollPosition:animated: doesn't seem to work
This method
(void)scrollToObjectAtIndex:(NSInteger)index atScrollPosition:(GMGridViewScrollPosition)scrollPosition animated:(BOOL)animated
is not working at all with my project
This is how I init the GMGrid
self.grid = [[GMGridView alloc] initWithFrame:CGRectMake(14, 228, 292, 260)];
self.grid.dataSource = self;
self.grid.itemSpacing = 0;
self.grid.minEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
self.grid.clipsToBounds = YES;
[self.grid setPagingEnabled:YES];
[self.grid setLayoutStrategy:[GMGridViewLayoutStrategyFactory strategyFromType:GMGridViewLayoutHorizontalPagedLTR]];
[self.mainView addSubview:self.grid];
and after that in my code I add a value to the self.data, plus a call to [self.grid reloadData] (and the grid is updated) and then
[self.grid scrollToObjectAtIndex:(self.data.count - 1) atScrollPosition:GMGridViewScrollPositionBottom animated:YES];
I tried with different value for atScrollPosition:GMGridViewScrollPositionBottom with no success,
do you have any clue about what's going wrong?
Thanks in advance
Hi, I have been observing the same issue while trying to set a specific index with the HorizontalPagedLTR strategy. I am not working on the latest version right now though. Was there a fix on this issue ? thanks!
I am observing the same issue, is it working now?
I don't know if this works for a GMGridViewLayoutHorizontalPagedLTR layout strategy, but I was having the same issue with a GMGridViewLayoutHorizontal layout strategy.
I got it to work by setting the layoutStrategy before the dataSource or the GMGridView.
Isn't working...
I had to use this (I'm using a UIPageControl):
CGRect frame = _gmGridView.frame;
frame.origin.x = frame.size.width * page;
frame.origin.y = 0;
[_gmGridView scrollRectToVisible:frame animated:YES];