Closed sanojKashyap closed 8 years ago
I had a similar issue like yours when my HorizontalPicker is very narrow.
I managed to stop the behaviour by slightly modifying HPCollectionVC's indexForCenterCellFromCollectionView method:
- (NSInteger)indexForCenterCellFromCollectionView:(UICollectionView *)collectionView
{
NSInteger index = 0;
// check if baseAdjustments where made in HorizontalPickerView
if (collectionView.contentOffset.x) {
CGPoint point = collectionView.contentOffset;
point.x += collectionView.frame.size.width / 2;
// modified min of point.x
point.x = MIN(collectionView.contentSize.width - 1.0f, point.x);
point.y += collectionView.frame.size.height / 2;
index = [collectionView indexPathForItemAtPoint:point].row;
}
return index;
}
Hope it helps.
I am facing issue, in which if scroll all the way to right will reset to 0 index which should be last index. Please, help me out.