GMGridView
GMGridView copied to clipboard
Bug when calling scrollToObjectAtIndex with paging enabled (paged horizontal layout strategy)
When calling scrollToObjectAtIndex
with paging enabled (paged horizontal layout strategy) and centerGrid = YES
targetRect
is calculated wrong. The problem seems to be that we have edgeInsets
not equal 0; so - (CGRect)rectForPoint:(CGPoint)point inPaggingMode:(BOOL)paging
returns rect for another cell (row+1 and column+1).
This is a real problem - seems that even pageSize calculation is wrong...
I guess there is a link with https://github.com/gmoledina/GMGridView/issues/103
The pageSize calculation seems to be OK, the problem is in the while condition: while (originScroll.x + pageSize.width < point.x) ---> should be while (originScroll.x + pageSize.width <= point.x) { originScroll.x += pageSize.width; }
while (originScroll.y + pageSize.height < point.y) ----> Should be while (originScroll.y + pageSize.height <= point.y)
{
originScroll.y += pageSize.height;
}
In any case in the commit e575ce2 Mar, 11, 2012 There is a change that introduce a new method named
- (CGRect)rectForPoint: inPaggingMode: that seems to fix the problem. I have not had time to verify, I will let you know.
Still doesn't work I think.