From 2117299cbd2635b6d7eb4dfb86e05fd32bf47cdc Mon Sep 17 00:00:00 2001 From: James Chong Date: Tue, 4 Aug 2015 16:35:25 +0900 Subject: [PATCH] Bug Fix - Button Bar Selection on Current Page Issues When you select button for current page, selected bar does not update when you scroll container scroll view. The reason is that 'shouldUpdateButtonBarView' varaible does not reset back to true, because [UIScrollViewDelegate scrollViewDidEndScrollingAnimation] is never called when you select button for current page. I resolved this issue by avoiding current page selection by comparing NSIndexPath.item with self.currentIndex. --- .../XL/Controllers/XLButtonBarPagerTabStripViewController.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/XLPagerTabStrip/XL/Controllers/XLButtonBarPagerTabStripViewController.m b/XLPagerTabStrip/XL/Controllers/XLButtonBarPagerTabStripViewController.m index abbc7d9..8063d6b 100644 --- a/XLPagerTabStrip/XL/Controllers/XLButtonBarPagerTabStripViewController.m +++ b/XLPagerTabStrip/XL/Controllers/XLButtonBarPagerTabStripViewController.m @@ -168,6 +168,9 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + if (indexPath.item == self.currentIndex) + return; + [self.buttonBarView moveToIndex:indexPath.item animated:YES swipeDirection:XLPagerTabStripDirectionNone]; self.shouldUpdateButtonBarView = NO;